静态页面传值

<script language="javascript">
var tmpArr,QueryString;
var URL = document.location.toString();
if(URL.lastIndexOf("?")!=-1){
QueryString= URL.substring(URL.lastIndexOf("?")+1,URL.length);
tmpArr=QueryString.split("&");
for (i=0;i<=tmpArr.length;i++)
{ try{eval (tmpArr[i]);}
catch (e){
var re = new RegExp("(.*)=(.*)","ig");
re.exec(tmpArr[i]);
try{eval (RegExp.$1+"="+"\""+RegExp.$2+"\"");}
catch(e){}
}
}
}
else
{
QueryString="";
}
</script>
<script language="javascript">
document.write ("查询串为:"+QueryString+"<br>");
if (typeof(ID)!="undefined")
{document.write ("ID 值 为:"+ID+"<br>");}
if (typeof(Name)!="undefined")
{document.write ("Name值为:"+Name+"<br>");}
</script>

你可能感兴趣的:(静态)