url 参数

2018-08-08  本文已影响10人  就那两三事

http://www.mywebsite.com/sj/test/test.aspx?name=kath&sex=man#Anchor=zxw

window.location.href 获取整个URL字符串
window.location.protocol 获取协议部分,即:“http:”
window.location.host 获取服务器地址,即:“www.mywebsite.com
window.location.port 获取端口,如果url没有返回空字符串,即:“”
window.location.pathname 获取文件路径,即:“/sj/test/test.aspx”
window.location.search获取参数,即:“?name=kath&sex=man”
window.location.hash获取锚点,即:“#Anchor=zxw”

上一篇 下一篇

猜你喜欢

热点阅读