function getUrlQuery() {
var urlStr = location.search.substr(1) ? location.search.substr(1) : "";
var urlArr = [];
for(var i = 0; i < urlStr.split("&").length; i++) {
urlArr.push(urlStr.split("&")[i].split("=")[0] ? urlStr.split("&")[i].split("=")[0] : "");
urlArr.push(urlStr.split("&")[i].split("=")[1] ? urlStr.split("&")[i].split("=")[1] : "onlyKey")
}
if(urlStr == "") {
return;
} else {
var urlObj = {}
for(var i = 0; i < urlArr.length; i += 2) {
if(urlArr[i] != "") {
urlObj[urlArr[i]] = decodeURIComponent(urlArr[i + 1]);
}
}
return urlObj;
}
}
版权声明:本文为CSDN博主「cmyh」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/cmyh100/article/details/76995928