⭐️如果对你有用的话,希望可以点点赞,感谢了⭐️
function getUrlParam(key){var url = decodeURI(window.location.href);var paramMap = {};var paramStr = url.split("?")[2];if (paramStr && paramStr != "") {var paramStrArr = paramStr.split("&");for (var i = 0; i < paramStrArr.length; i++) {var temp = paramStrArr[i];var indexE = temp.indexOf("=");var pKey = temp.substring(0, indexE);var pVal = temp.substring(indexE + 1);paramMap[pKey] = pVal;}}return paramMap[key];
}
以上即是获取URL中的某个参数值
引用上述函数,可如下引用
var aa = getUrlParam("ishtfk");