javascript使用location.search的示例_javascript技巧
程序员文章站
2022-03-29 14:04:41
...
复制代码 代码如下:
function GetRequest() {
var url = location.search; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
var Request = new Object();
Request = GetRequest();
var 参数1,参数2,参数3,参数N;
参数1 = Request['参数1'];
参数2 = Request['参数2'];
参数3 = Request['参数3'];
参数N = Request['参数N'];
推荐阅读
-
javascript中checkbox使用方法简单实例演示_javascript技巧
-
JS获取节点的兄弟,父级,子级元素的方法_javascript技巧
-
JavaScript更改class和id的方法_javascript技巧
-
Javascript 闭包引起的IE内存泄露分析_javascript技巧
-
利用javascript的面向对象的特性实现限制试用期_javascript技巧
-
使用百度地图api实现根据地址查询经纬度_javascript技巧
-
innerHTML 和 getElementsByName 在IE下面的bug 的解决_javascript技巧
-
JavaScript下申明对象的几种方法小结_javascript技巧
-
JavaScript 用cloneNode方法克隆节点的代码_javascript技巧
-
Javascript循环绑定事件的示例代码_javascript技巧