初學(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)文章
prototype Element學(xué)習(xí)筆記(篇二)
這一篇主要是要總論Element的所有函數(shù)。2008-10-10
Prototype 學(xué)習(xí) 工具函數(shù)學(xué)習(xí)($方法)
$方法——被成為瑞士軍刀$方法使用技巧。2009-07-07
Prototype Selector對(duì)象學(xué)習(xí)
這個(gè)對(duì)象在幫助文檔上并沒(méi)有,但是這個(gè)對(duì)象確是整個(gè)DOM操作的核心類(lèi),工具函數(shù)$$,其實(shí)就是調(diào)用這個(gè)類(lèi)的方法2009-07-07
prototype 1.5相關(guān)知識(shí)及他人筆記
prototype 1.5相關(guān)知識(shí)及他人筆記...2006-12-12
Prototype RegExp對(duì)象 學(xué)習(xí)
幫助文檔上沒(méi)有這個(gè)對(duì)象,實(shí)際上源代碼中這個(gè)對(duì)象還是有方法的,就1靜態(tài)方法,作用也不是很大,這里簡(jiǎn)單說(shuō)一下,因?yàn)橐院蠼榻B別的對(duì)象時(shí)會(huì)用到這個(gè)RegExp2009-07-07
prototype 源碼中文說(shuō)明之 prototype.js
prototype 源碼中文說(shuō)明之 prototype.js...2006-09-09

