Home > Web Front-end > JS Tutorial > Beginner to prototype, send a JS code to accept URL parameters_prototype

Beginner to prototype, send a JS code to accept URL parameters_prototype

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 19:20:55
Original
966 people have browsed it

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<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("提交参数:"+arg) for(var cou in arg ) document.write(" 参数"+arg[cou]+"的值为:"+url.request(arg[cou])+" ") </script>
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template