function getParam(keyName){
var currentPara = {}
var hash = window.location.search.substr(1);
var split = hash.split("&");
for (var i = 0, l = split.length; i < l; i++) {
var key = split[i].split("=");
if (key.length === 2) {
currentPara[key[0]] = key[1];
}
}
return currentPara[keyName] ? currentPara[keyName] : '';
}
调用:
var token = getParam("paramName");