首页 > html > HTML页面如何象ASP一样接受参数

HTML页面如何象ASP一样接受参数

时间:2008-5-8 浏览: 作者:admin
<script language="javascript">
var pos,str,para,parastr,tempstr1;
tempstr="";
str = window.location.href;
pos = str.indexOf("?")
parastr = str.substring(pos+1);
document.write("<br>文件路径:"+str);
if (pos>0){
document.write("<br>所有参数:"+parastr);
}
else
{
document.write ("无参数");
}


if (str.indexOf("&")>0){
para = parastr.split("&");
for(i=0;i<para.length;i++)
{
tempstr1 = para;

pos = tempstr1.indexOf("=");
//document.write (tempstr1.substring(0,pos));
document.write ("<br>参数"+i+":"+tempstr1.substring(0,pos));
document.write ("等于:"+tempstr1.substring(pos+1));
}
}
</script>
    打印本页    关闭窗口  
上一篇:CSS中常用的单位
下一篇:没有了
相关文章
最新评论

暂任何数据!
不能超过250字,请自觉遵守互联网相关政策法规。
昵称: 验 证 码: