复制代码 代码如下: var id; function getid() { var url=location.search; var Request = new Object(); if(url.indexOf("?")!=-1) { var str = url.substr(1) //去掉?号 strs = str.split("&"); for(var i=0;i<strs.length;i++) { Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } id=Request["id"]; document.getElementById('td_fa').innerHTML=id + "页面信息"; } 这样就好办了。。。传参和.net一样"http://www.aaa.html?id=1"就可以了。
推荐阅读
Array.prototype.slice 使用扩展
除了正常用法,slice 经常用来将 array-like 对象转换为 true array. 名词解释:array-like object – 拥有 length 属性的对象,比如 { 0: ‘foo', length: 1 }, 甚至 { length: ‘bar' }. 最常见的 array-like 对>>>详细阅读
本文标题:location.search在客户端获取Url参数的方法
地址:http://www.17bianji.com/kaifa2/JS/26218.html
1/2 1