你输入错误,少了个?号,多了个&,应该是http://www.web.com/index.asp?aa=1&bb=2

解决方案 »

  1.   

    http://www.web.com/index.asp&aa=1&bb=2
    更正为
    http://www.web.com/index.asp?aa=1&bb=2不是这个意思哦!
    我需要,在地址栏中输入url后,回车,可以通过js获得这个url。
      

  2.   

    我刚刚试了一下,用以下这个是可以的
    <script language="javascript">
    alert(location.href);
    </script>
      

  3.   

    是么???
    比如:
    test.html
    ---------------
    <script language="javascript">
    alert(location.href);
    </script>打开test.html直接运行,结果是弹出:*****/test.html
    正确!这时候,修改地址栏数据为:*****/test.html?aa=1&bb=2
    就的不到了
      

  4.   

    no body can help me ???
      

  5.   

    window.location.search它包含了?后的部分 然后用window.location.search。                xcxcxCx
      

  6.   

    对不起!刚刚机器有点问题 用window.location.search.substring(1)得到
    ?后的串 然后用字符串操作 其余的相信你知道怎么做
      

  7.   

    <%IF Request.QueryString("aa")="" and Request.QueryString("bb")="" Then%>
    <Script>window.location.href="index.asp?aa=***&bb=***";</Script>
    <%End IF%>没大看懂你的意思,不知道是不是要这么做!
    输入http://www.web.com/index.asp自动跳转到http://www.web.com/index.asp?aa=1&bb=2
      

  8.   

    别忘了给分function getQuery(name) {
    var reg = new RegExp("(^|&)"+name+"=([^&]*)(&|$)");
    var r = location.search.substr(1).match(reg);
    if (r!=null){
    return unescape(r[2]);
    }
    }
      

  9.   

    我曾经问过相似的问题,可以看看.
    http://expert.csdn.net/Expert/topic/2918/2918583.xml?temp=.5131342