<script language="javascript" type="text/javascript">
//js获取url参数的function
function request(paras){
var url = location.href;
var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
var paraObj = {}
for (i=0; j=paraString[i]; i++){
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf
("=")+1,j.length);
}
var returnValue = paraObj[paras.toLowerCase()];
if(typeof(returnValue)=="undefined"){
return "";
}else{
return returnValue;
}
}
var theurl
theurl=request("url");
if (theurl!=''){
location=theurl
}
</script>
本文来自: 脚本之家(www.jb51.net) 详细出处参考:http://www.jb51.net/article/13242.htm
----------------------------------------------------------
<script language="javascript" type="text/javascript">
function local(id,addid,color)
{
//var url= window.location.search;
var url_arr=GetURLRequest(window.location.href).split('|');//获取当前页REQUEST集合,并存入数组。
for(i=0;i<url_arr.length;i++)
{
alert('这是第'+i+'个REQUEST值:'+url_arr[i]);
}
}
function GetURLRequest(Url)
{
var u,g,StrBack='',RETURNVALUE="";
if(arguments[arguments.length-1]=="#"){u=Url.split("#");}else{u=Url.split("?");}
if (u.length==1)g='';else g=u[1];
if(g!='')
{
gg=g.split("&");
var MaxI=gg.length;
str = arguments[0]+"=";
for(xm=0;xm<MaxI;xm++)
{
if(gg[xm].indexOf(str)==0)
{
StrBack=gg[xm].replace(str,"");
break;
}
RETURNVALUE+=gg[xm].substring(gg[xm].indexOf('=')+1)+"|";
}
}
return RETURNVALUE.substring(0,RETURNVALUE.length-1);
}
</script>