复制代码 代码如下:
<script>
functionrequest(key)
{
if(typeof(this)=="undefined")returnfalse;
if(this.length>0)
{
vars=this.split("&");
for(variins)
{
varsp=s[i].split("=")
if(sp[0]==key)return(sp[1]);
}
returnfalse;
}
elsereturnfalse
}
functiongetAllKey()
{
if(typeof(this)=="undefined")returnfalse;
vararr=newArray;
if(this.length>0)
{
vars=this.split("&");
for(variins)
{
varsp=s[i].split("=");
arr.push(sp[0]);
}
returnarr;
}
elsereturnfalse
}
String.prototype.request=request
String.prototype.getAllKey=getAllKey
//===================================================
varurl=location.search.substr(1)//action=reply&forum=3&topic=1469
vararg=url.getAllKey()
alert(arg)
document.write("提交参数:"+arg)
for(varcouinarg)
document.write("<br>参数"+arg[cou]+"的值为:"+url.request(arg[cou])+"<br>")
</script>