码迷,mamicode.com
首页 > Windows程序 > 详细

window.location

时间:2017-05-02 17:26:19      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:tab   indexof   url   www   host   layui   port   oca   arc   

 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 完整的 URL
18 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

标签:tab   indexof   url   www   host   layui   port   oca   arc   

原文地址:http://www.cnblogs.com/linsx/p/6797076.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!