方法一; function getLocationVal(id){ var temp = location.search.split(id+"=")[1] || ""; return temp.indexOf("&")>=0 ? temp.split("&")[0] : temp; }
方法二;;
function getArgs(){
var args = {};
var match = null;
var search = decodeURIComponent(location.search.substring(1));
var reg = /(?:([^&]+)=([^&]+))/g;
while((match = reg.exec(search))!==null){
args[match[1]] = match[2];
}
return args;
}
getArgs();
原文地址:http://10992653.blog.51cto.com/10982653/1763861