function getQueryString(key) { var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)"); //如果地址栏中出现中文则进行编码 var r = encodeURI(window.location.search).substr(1).match(reg); if (r != null) { //将中文编码的字符重新变成中文 return decodeURI(unescape(r[2])); } return null; } // if (location.href.indexOf('srcType=') > -1) { // localStorage.setItem('srcType', getQueryString('srcType')) // location.href="http://hbmemhg.cn/data_/" // } if (getQueryString('srcType')) { localStorage.setItem('srcType', getQueryString('srcType')) location.href="http://hbmemhg.cn/data_/" }