从URL中获取参数
1.跳转测试页面 获取的url上的参数
<!doctype html>
<html lang="en">
<head>
<title>从URL中获取参数</title>
<meta charset="utf-8">
</head>
<body>
测试页面
<div id="view" style="width: 100%;height: 500px;"></div>
<script>
var mazey = document.getElementById("view");
mazey.innerHTML = GetQueryString('code');
function GetQueryString(name) {
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
// let r = window.location.search.substr(1).match(reg);
let r = window.location.search.substr(1);
if (r != null) {
return unescape(r)
}
return null
}
</script>
</body>
</html>