JQuery如何在浏览器中获取URL参数值代码?

树叶云

 

JQuery如何在浏览器中获取URL参数值代码

 

使用方法如下:getParam($a);

 

//获取URL的相关参数值

function getParam(paramName){

paramValue =””;

isFound =false;

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){

if (arrSource[i].indexOf(“=”) >0){

if (arrSource[i].split(“=”)[0].toLowerCase()==paramName.toLowerCase()){

paramValue = arrSource[i].split(“=”)[1];

isFound =true;

}

}

i++;

}

}

return paramValue;

};

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/115139.html<

(0)
运维的头像运维
上一篇2025-02-18 00:35
下一篇 2025-02-18 00:36

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注