-
URl:http://localhost/whu/info.html?name=四合网吧&address=尖草坪区迎新街东二条&infoid=1&people=2
-
使用网上搜索到的正则表达式查找方式
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;
}
解决方法
if (r != null) return unescape(r[2]); return null; 中的 unescape 用 decodeURI 替换