Method 1: Regular Analysis
function getQueryString(name) {
var reg = new RegExp("(^|&)" name "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
Calling method:
alert(GetQueryString("Parameter name 1")); alert(GetQueryString("Parameter name 2"));
alert(GetQueryString("Parameter name 3"));
Method 2
< Script language="javascript">
function GetRequest() {
var url = location.search; //Get the string after the "?" character in the url
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i ) {
theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=") [1]);
}
}
return theRequest;
}
Calling method: