A simple example to use:
<script language= "JavaScript" >
<!--
var q = location.search.substr (1);
var qs = q.split ("&");
if (QS) {
for (Var i=0;i<qs.length;i++) {
Alert ("QueryName:" +qs[i].substring (0,qs[i].indexof ("=")) + "\nqueryvalue:" +qs[i].substring (qs[i].indexof ("=") +1) )
}
}
-->
</SCRIPT>
Examples in the Java authoritative guide:
function Getargs ()
{
var args=new Object ();
var query=location.search.substring (1);//Get query string
var pairs=query.split (",");//Break at comma
for (Var i=0;i<pairs.length;i++)
{
var pos=pairs[i].indexof (' = ');//Find Name=value
if (pos==-1) continue;//skipped if not found
var argname=pairs[i].substring (0,pos);//Extract Name
var value=pairs[i].substring (pos+1);//Extract value
Args[argname]=unescape (value);//Save As Property
}
Return args;//Object
This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20120721/32075.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.