• 首页
  • 小学语文
  • 中学语文
  • 中学英语
  • 免费论文
  • 教学随笔
  • 学生作文
  • 综合考试
  • 试题教案
  • 育儿话题
  • 教学资源
  • 编程技术
  • 博客
  • HTML页面如何象asp一样接受参数

    日期:2003-03-11  地址:  作者:

    <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[i];
     
     pos = tempstr1.indexOf("=");
     //document.write (tempstr1.substring(0,pos));
     document.write ("<br>参数"+i+":"+tempstr1.substring(0,pos));
     document.write ("等于:"+tempstr1.substring(pos+1));
     }
     }
    </script>

     

    对 HTML页面如何象asp一样接受参数 文章的评论    [查看网友评论]

    验证码:
    匿名发表: