Javascript
There are generally two ways to submit data for a page: Get,post. Post is the so-called form submission, which uses views, and get is submitted by URL.
Get methods generally use background code (such as asp,asp.net) to obtain parameters, the code is very simple: request.querystring["id";
Sometimes need to directly in the foreground to get the URL parameters, to use the JAVASCRIPT,JS did not directly get the URL parameters of the method, then, how do we get the URL parameters js?
Read code Edit Code run effect copy HTML code save code <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> New Document </title>
<meta name= "generator" content= "EditPlus"/>
<meta name= "Author" content= ""/>
<meta name= "keywords" content= ""/>
<meta name= "description" content= ""/>
<script type= "Text/javascript" >
function Geturlparms ()
{
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;
}
How to use:
var args = new Object ();
args = Geturlparms ();
If you want to find the parameter ArticleID:
var ArticleID = args["ArticleID"];
alert (ArticleID);
If you are looking for a parameter typeid
var typeid = args["typeID"];
alert (typeid);
</script>
<body>
</body>