1 <html lang="en"> 2 <head> 3 <meta charset="UTF-8"> 4 <meta name="Generator" content="EditPlus®"> 5 <meta name="Author" content=""> 6 <meta name="Keywords" content=""> 7 <meta name="Description" content=""> 8 <title>js_获取参数</title> 9 <script> 10 function GetQueryString(name) 11 { 12 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 13 var r = window.location.search.substr(1).match(reg); 14 if(r!=null)return unescape(r[2]); return null; 15 } 16 17 // 调用方法 18 alert(GetQueryString("a")); 19 alert(GetQueryString("b")); 20 alert(GetQueryString("c")); 21 //str.toLowerCase() 转换成小写 22 //str.toUpperCase() 字符串全部转换成大写 23 </script> 24 </head> 25 <body> 26 27 </body> 28 </html>