window.location.href
和window.location.hash不能用请问怎么做?

解决方案 »

  1.   

    可以 改变 scrollTop的值
    或者
    在要跳转的目标位置写a标签 ,然后聚焦
    比如
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <style type="text/css">
    </style>
    </head>
    <body>
    <button onclick="document.getElementById('a').focus()">click</button>
    <a href="#" id="a" style="display:block; margin-top:1600px;">aaaaaaaaaa</a>
    </body>
    </html>
      

  2.   

    我用的是scrllTo(0,Y);
    但Y是写死的,
    我没有去测试不同分辨率是否正确。
    谢谢