1 function GetQueryString(name) { 2 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); 3 var r = window.location.search.substr(1).match(reg); 4 if (r!=null) return (r[2]); return null; 5 } 6 alert(GetQueryString("参数名1")); 7 alert(GetQueryString("参数名2")); 8 alert(GetQueryString("参数名3"));