说明:该方法摘自JavaScript高级程序设计
function getQueryStringArgs(){
var qs = (location.search.length > 0 ? location.search.substring(1) : "");
var args = {};
var items = qs.length ? qs.split("&") : [];
var item = null,
name = null,
value = null,
i = 0,
len = items.length;
for(i = 0; i< len;i++){
item = items[i].split("=");
name = decodeURIComponent(item[0]);
value = decodeURIComponent(item[1]);
if(name.length){
args[name] = value;
}
}
return args;
}
//获取方式为
var loanId = getQueryStringArgs()["loanId"];//["loanId"]中的loanId为url后面的参数属性
时间: 2024-11-09 01:56:40