var getUrlParam = function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)"),
r = window.location.search.substr(1).match(reg);
console.log(window.location.search)
if (r!=null){
return unescape(r[2]);
}else {
return null;
}
}
// http://localhost:8000?param=1
console.log(getUrlParam("param")) // 输出1 字符串型