静态页面传值

<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>
posted @ 2010-05-13 20:37  凡的世界  阅读(574)  评论(0编辑  收藏  举报