欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

初學(xué)prototype,發(fā)個(gè)JS接受URL參數(shù)的代碼

 更新時(shí)間:2006年09月25日 00:00:00   作者:  
復(fù)制代碼 代碼如下:

<script>
function request(key)
{
if(typeof(this)=="undefined")return false;
if(this.length>0) 

var s = this.split("&"); 
for(var i in s) 

var sp=s[i].split("=")
if(sp[0]==key)return(sp[1]);

return false;

else return false
}
function getAllKey()
{
if(typeof(this)=="undefined")return false;
var arr=new Array;
if(this.length>0) 

var s = this.split("&"); 
for(var i in s) 

var sp=s[i].split("=");
arr.push(sp[0]);

return arr;

else return false
}
String.prototype.request=request
String.prototype.getAllKey=getAllKey
//===================================================
var url=location.search.substr(1) //action=reply&forum=3&topic=1469
var arg=url.getAllKey()
alert(arg)
document.write("提交參數(shù):"+arg)
for(var cou in arg )
document.write("<br>參數(shù)"+arg[cou]+"的值為:"+url.request(arg[cou])+"<br>")
</script>

相關(guān)文章

最新評(píng)論