function getQueryStringArgs() { //删除查询字符串的问号 let qs = (location.search.length > 0 ? location.search.substring(1) : ""); //定义被拆解过后的对象 args = {}; name = null; value = null; item = null; //获取第一次拆解后的数组 items = qs.length ? qs.split("&") : []; //遍历items的每一项 for(let i = 0; i < items.length; i++) { item = items[i].split("="); name = decodeURIComponent(item[0]); value = decodeURIComponent(item[1]); if(name.length) { args[name] = value; } } return args; }