获取问号以后的 参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return 0; } 比如123.com/index.html?a=1&b=2. GetQueryString("a") 就是1 GetQueryString("b") 就是2 获得#号以后的 hash = window.location.hash; 假如123.com/index.html?a=1&b=2#top 那么hash的值为: #top
解析URL
最新推荐文章于 2023-04-19 11:00:24 发布