我现在想实现,点击某个东西,就动态改变一下地址栏的URL可以吗?

解决方案 »

  1.   

    window.location = 'http://www.baidu.com';
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <input type="button" value="click me" id="btn" />
        
        <script>
         document.getElementById('btn').onclick = function(){
    window.location = 'http://www.baidu.com';
    };
        </script>
    </body>
    </html>
      

  3.   

    window.location.href = 'http://www.baidu.com';
      

  4.   

    window.location = '你的url';
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <script type="text/javascript">
    window.location = 'http://www.baidu.com';
    </script>
    </body>
    </html>直接跳转.....
      

  6.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
        <input type="button" value="click me" id="btn" />
        
        <script>
            document.getElementById('btn').onclick = function(){
                window.location = 'http://www.baidu.com';    
            };
        </script>
    </body>
    </html>
      

  7.   


    如果是这样的话~·
    那估计做不到,要是改变了url地址的话。肯定会跳转的
      

  8.   


    哦好的。谢谢。。我的需求是这样的。我页面中的数据都是异步过来的。而且还不少。。当用户点击某个信息的时候,我就想把相应的参数也加到URL中,这样。用户刷新页面的时候,我还能让他们保持在相同的数据下面,那我看看能不能用onunload来变相实现吧 
      

  9.   


    window.location = 'http://www.baidu.com?'+参数;你可以这样,只是页面会刷新一下而已~· 
      

  10.   


    你可以这样,如果页面刷新就把window.location存到后台数据,然后每次用户要是刷新页面的话,就先从后台数据中读取,要是有就显示。
      

  11.   


    不客气~·要是OK了~·楼主别忘了结贴~·HOHO~·
      

  12.   

    点击下一页得时候,构造你的url呀..www.abc.com/page.aspx?pageindex=1&pagesize=10
    这样信息就在url里了嘛
      

  13.   


    URL怎么了 你就当一字符串呗
    跳的时候再location  有啥不行的
    实在不行
    eval("window.location = '"+URL+"'";)