如何获取url上面的参数

例如 :网页.html?id=0

//获取url中"?"符后的字串  go
function getRequest() {
var url = window.location.search;
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}
return theRequest;
}
var Request = new Object();
Request = getRequest();
var id=Request['id'];
console.log(id);
上一篇:centos安装nginx(针对一哥们的博客进行的详细补充(用红色字体标出了补充部分))


下一篇:centos 安装 nginx 及配置 的坑