JS代码:
function getQueryString(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)",'i');
var res = window.location.search.substr(1).match(reg);
if(res[2]){
return res[2];
}else{
return null;
}
}
调用样例:
var userName = getQueryString('userName');