Page
In the "Microcomputer World" saw an article " in HTML Web page skillfully using URL" to talk about how HTML pages like the ASP to accept the parameters of the problem, look like a thunderbolt general, Originally there are window.location.href such good dongdong, blame oneself weekdays bad good-looking material.
After reading, I immediately wrote the JS function to filter the corresponding parameters, plus the regular formula, really perfect. with DHTML and XML, a static site will live, it is amazing!
Javasctript implementation
function Request (querystring) {
var strhref=window.location.href;
var strparm;
if (Strhref.search (/\?/)!=-1) {
Strhref=strhref.substr (Strhref.search (/\?/) +1);
Strhref=strhref.split (/&/);
for (var icount = 0; icount<strhref.length; icount++) {
if (Strhref[icount].search ("^" +querystring+ "=")!=-1) {
Strparm=strhref[icount].substr (querystring.length+1)
}
}
return (Strparm);
}
}
If the lookup parameter is unsuccessful, the return value = "Undefined" can be judged again. This number only matches one of the last parameters found. (This method in February 2004 has been implemented, applied in my two HTML version of the Web site, is written on the Blogbus, hehe.) )