获取页面参数

function GetLocationParam(param){ //获取页面参数
var request = {
QueryString : function(val) {
var uri = window.location.search;
var re = new RegExp(“” +val+ “=([^&?]*)”, “ig”);
return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
}
}
return request.QueryString(param);
}

js中就可以这样调用
如URL为http://www.itlearner.com/test.htm?name=hx

就可以把name的值赋给js中的name变量

Popularity: 1%

No Responses to “获取页面参数”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>