url:http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere 1.window.location.href:返回整个url串 2.window.location.protocol:返回协议部分,本例中为 http: 3.window.location.host : 返回主机本分,本例中为www.x2y2.com 4.window.location.port: 返回端口部分,在本例中为 ""(只要是采用的80端口。不管是默认的还是url后面带有80的字样) 5.window.location.pathname:返回路径部分,在本例中为/fisker/post/0703/window.location.html 6.window.location.search:返回查询参数部分,在本例中为?ver=1.0&id=6 7.window.location.hash:返回锚点部分,在本例中为#imhere
Js - 获取url地址栏
最新推荐文章于 2021-10-29 11:37:43 发布