<div id="bgtm"> <a href='1.html?id=12&grade=0'>成绩</a> </div> <script> function GetUrlParam(paraName) { var url = document.location.toString(); var arrObj = url.split("?"); if (arrObj.length > 1) { var arrPara = arrObj[1].split("&"); var arr; for (var i = 0; i < arrPara.length; i++) { arr = arrPara[i].split("="); if (arr != null && arr[0] == paraName) { return arr[1]; } } return ""; } else { alert('参数错误!'); window.location.href="1.html?id=12&grade=0"; } } console.log(GetUrlParam("grade")); </script>