首页 > 代码库 > window.location

window.location

 1 $(function(){ 2     //标记当前TAB 3     $("[data-tab-tag]").each(function(){ 4         var tag = $(this).data("tab-tag"); 5         if(window.location.toString().indexOf(tag) != -1){ 6             $("[data-tab-tag]").removeClass("layui-this"); 7             $(this).addClass("layui-this"); 8         } 9     });10 });11 </script>12 13 window.location是一个对象,包含属性有14 hash 从井号 (#) 开始的 URL(锚)15 host 主机名和当前 URL 的端口号16 hostname 当前 URL 的主机名17 href 完整的 URL18 pathname 当前 URL 的路径部分19 port 当前 URL 的端口号20 protocol 当前 URL 的协议21 search 从问号 (?) 开始的 URL(查询部分)22 获取window.location.href是最常用的

http://www.w3school.com.cn/js/js_window_location.asp

https://developer.mozilla.org/zh-CN/docs/Web/API/Window/location

window.location