为什么 window.location.search 为空?

1.什么是window.location?

示例
URL:http://b.a.com:88/index.php?name=kang&when=2011#first

属性 含义
protocol: 协议 “http:”
hostname: 服务器的名字 “b.a.com”
port: 端口 “88”
pathname: URL中主机名后的部分 “/index.php”
search: “?”后的部分,又称为查询字符串 “?name=kang&when=2011”
hash: 返回”#”之后的内容 “#first”
host: 等于hostname + port “b.a.com:88”
href: 当前页面的完整URL “http://www.a.com:88/index.php?name=kang&when=2011#first”

window.location和document.location互相等价的,可以交换使用
location的8个属性都是可读写的,但是只有href与hash的写才有意义。例如改变location.href会重新定位到一个URL,而修改location.hash会跳到当前页面中的anchor(或者

你可能感兴趣的:(javascript)