动人口红

文章
8
资源
0
加入时间
4年2月7天

JS_js获取当前完整的url地址及获取url地址中各个部分,window.location对象详解

window.location.host; //(域名 + 端口)返回url 的主机部分,例如:www.xxx.com window.location.hostname; //(域名)返回www.xxx.com window.location.href; //(当前URL)返回整个url字符串(在浏览器中就是完整的地址栏),例如:www.xxx.com/index.php?class_id=3&id=2 window.location.pathname; //(路径部分)返回/a