<!DOCTYPE html>
<html>
<head>
<script>
$(document).ready(function(){
window.onload = function test(){
if(getQueryString("param") != undefined){
alert(getQueryString("param"));
}
}
//获取URL中传来的参数的函数
function getQueryString(key){
var reg = new RegExp("(^|&)"+key+"=([^&]*)(&|$)");
var result = window.location.search.substr(1).match(reg);
return result?decodeURIComponent(result[2]):null;
}
});
</script>
</head>
<body onload="test()">
</div>
</body>
</html>
js获取URL中传来的参数
最新推荐文章于 2023-08-29 09:58:53 发布