分解页面 url 传入参数
转载: 来自https://www.jianshu.com/p/6dd040f6800d
function init_params() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for(var i = 0; i < strs.length; i ++) { theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } return theRequest; } var params = init_params() console.log('params', params)
标签:theRequest,url,JavaScript,strs,分解,params,split,var From: https://www.cnblogs.com/ximu1009/p/17029937.html