js获取url中的指定参数
作者:互联网
js获取url中指定的参数
function getUrlParam(paraName) {
var url = document.location.toString();
var arrObj = url.split("?");
if (arrObj.length > 1) {
var arrPara = arrObj[1].split("&");
var arr;
for (var i = 0; i < arrPara.length; i++) {
arr = arrPara[i].split("=");
if (arr != null && arr[0] == paraName) {
return arr[1];
}
}
return "";
}
else {
return "";
}
}
标签:arr,return,url,js,参数,split,var,arrObj 来源: https://blog.csdn.net/qq_24935119/article/details/97395109