其他分享
首页 > 其他分享> > 获取当前页面url指定参数值

获取当前页面url指定参数值

作者:互联网

function getParam(paramName) {
paramValue = "", isFound = !1;
if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
}
return paramValue == "" && (paramValue = null), paramValue
}

标签:search,url,paramValue,isFound,location,&&,arrSource,参数值,页面
来源: https://www.cnblogs.com/EternalZH/p/10644449.html