1. Use Window.location.search to obtain the following parameters
The name of the param parameter
function GetParameter (param)
{
var query = Window.location.search;
var ilen = param.length;
var iStart = query.indexof (param);
if (IStart = =-1)
Return "";
IStart + = Ilen + 1;
var iend = Query.indexof ("&", IStart);
if (iend = =-1)
Return query.substring (IStart);
Return query.substring (IStart, iend);
}
Then call the GetParameter method: var temp = getparameter ("AA");
2. Use Window.location.href to obtain the following parameters
var url=window.location. href;
var aa=url.indexof (' = ');
if (aa = =-1)
Return "";
Url=url.substring (aa+1);
Window.alert (URL);
3. Save the following code as an HTML file: aa.htm, and then open the site:
Enter to display the demo effect and normally receive the value passed by the HTML file.
<script language= "JScript" >
<!-
var locstring=string (WINDOW.DOCUMENT.LOCATION.HREF);
function GetQueryString (str) {
var rs=new RegExp ("(^|)" +str+ "= ([^&]*) (&|$)", "GI"). EXEC (locstring), TMP;
if (TMP=RS) return tmp[2];
Return "without this parameter";
}
Alert ("Journal Number:" +getquerystring ("log_id"));
Alert ("Category number:" +getquerystring ("cat_id"));
Alert ("page number:" +getquerystring ("pages"));
-
</script>
Three ways to receive URL parameters in HTML