javascript取得地址栏参数
javascript取得地址栏参数
//paramName为参数名
function GetAddressParamValue(paramName)
{
var paramText = window.location.search;
paramText = paramText.substring(1,paramText.length);
var paramArray = paramText.split('&');
for (var i=0;i<paramArray.length;i++)
{
var sParam = paramArray[i];
if (sParam.indexOf(paramName + "=") != -1)
{
var paramLen = paramName.length + 1;
return sParam.substring(paramLen,sParam.length);
}
else
{
continue;
}
}
return "";
}
function GetAddressParamValue(paramName)
{
var paramText = window.location.search;
paramText = paramText.substring(1,paramText.length);
var paramArray = paramText.split('&');
for (var i=0;i<paramArray.length;i++)
{
var sParam = paramArray[i];
if (sParam.indexOf(paramName + "=") != -1)
{
var paramLen = paramName.length + 1;
return sParam.substring(paramLen,sParam.length);
}
else
{
continue;
}
}
return "";
}