js 获取参数

时间:2023-06-20 09:56:50
 <html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>js_获取参数</title>
<script>
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
} // 调用方法
alert(GetQueryString("a"));
alert(GetQueryString("b"));
alert(GetQueryString("c"));
//str.toLowerCase() 转换成小写
//str.toUpperCase() 字符串全部转换成大写
</script>
</head>
<body> </body>
</html>