window.location

http://www.google.cn/a/201105/a564.html?a=1#aa 

 

属性描述
hash 从井号 (#) 开始的 URL(锚)
host 主机名和当前 URL 的端口号
hostname 当前 URL 的主机名
href 完整的 URL
pathname 当前 URL 的路径部分
port 当前 URL 的端口号
protocol 当前 URL 的协议
search 从问号 (?) 开始的 URL(查询部分)

 

 

指令
结果
window.location.search
"?a=1"
window.location.protocol
http:
window.location.port
 
window.location.pathname
/a/201105/a564.html
window.location.href
http://www.google.cn/a/201105/a564.html?a=1#aa
window.location.hostname
www.google.cn
window.location.host
www.google.cn
window.location.hash
"#aa"

 

 

 

 

posted @ 2014-04-06 11:50  明娃儿  阅读(216)  评论(0编辑  收藏  举报