window.location对象常用属性

window.location
1: hash
该属性是一个可读可写的字符串,该字符串是url的锚部分(#开始以后部分)
window.location.hash = anchorname
http://example.com:1234/test.htm#part2 => part2
2:host
该属性可读可写,可设置或返回当前url的主机名和端口号。 http://example.com:1234/test.htm#part2 => example.com:1234
3:hostname
该属性可读可写,可设置或返回当前url的主机名。
http://example.com:1234/test.htm#part2 => example.com
4:href
该属性可读可写,返回完整的url
http://example.com:1234/test.htm#part2  => http://example.com:1234/test.htm#part2 
5:pathname
该属性可读可写,可设置或返回url的路径部分
http://example.com:1234/test/test.html#part2 => /test/test.html
6:port
port 属性是一个可读可写的字符串,可设置或返回当前 URL 的端口部分。
http://example.com:1234/test.htm#part2  => 1234
7:protocol
protocol 属性是一个可读可写的字符串,可设置或返回当前 URL 的协议。
http://example.com:1234/test.htm#part2 => http
8:search
search 属性是一个可读可写的字符串,可设置或返回当前 URL 的查询部分(问号 ? 之后的部分)。
https://editor.csdn.net/md?not_checkout=1&articleId=108315996 => not_checkout=1&articleId=108315996
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值