获取URL参数脚本

来源:互联网 发布:数据存储单位 编辑:程序博客网 时间:2024/05/22 08:11
var pos,str,para,parastr,tempstr1;
    var QueryString1,QueryString2,QueryString3;

    tempstr="";
    str = window.location.href;
    pos = str.indexOf("?")
    parastr = str.substring(pos+1);
   
    if (str.indexOf("&")>0)
    {
         para = parastr.split("&");
         for(i=0;i<para.length;i++)
         {
             tempstr1 = para[i];
            
             pos = tempstr1.indexOf("=");

             if(tempstr1.substring(0,pos) == "QueryString1")
                QueryString1 = tempstr1.substring(pos+1);
             if(tempstr1.substring(0,pos) == "QueryString2")
                QueryString2  = tempstr1.substring(pos+1);
             if(tempstr1.substring(0,pos) == "QueryString3")
                QueryString3  = tempstr1.substring(pos+1);
         }
    }



本文引用通告地址: http://blog.csdn.net/crazythief/services/trackbacks/172022.aspx
[点击此处收藏本文]
原创粉丝点击