複製程式碼如下:
函數 getParam(paramName) {
參數值 = "";
已找到=假;
if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
我 = 0;
while (i < arrSource.length && !isFound) {
if (arrSource[i].indexOf("=") > 0) {
if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
paramValue = arrSource[i].split("=")[1];
已找到=真;
}
}
我++;
}
}
返回參數值;
}
如://www.VeVB.COm/UserQuery.aspx?id=202
getParam("id")為202