加个锚链接比如
<a name="#4">4楼</a>
然后链接这样:www.xxx.com/test.html#4就可以定位到4楼了.

解决方案 »

  1.   

    拿到目标OFFSETHEIGHT
    再设置SCROLL
      

  2.   

    <html>
    <head>
    <script>
    function a(){
    var a=document.getElementById('a');
    window.scroll(0,a.offsetTop)
    }</script>
    </head>
    <body onload="a()">
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input type='text'  value='100' /><BR>
    <input id='a' type='text'  value='100' /><BR>
    </body>
    </html>刚刚说错了...OFFSETTOP才对.
      

  3.   

    其实我的本意是这样的,可能举得例子不够恰当。
    我写了个视频的网页
    左侧是视频,右侧是按视频播放的时间升序排列的评论(在style="overflow-y: scroll"里面),我想实现:拖动视频的播放条到某一时间时,右侧评论跟着居中显示出来。现在,拖动拖动视频的播放条后的时间已经被我捕获到了,问题是如何根据这个时间(亦即评论部分的播放时间)把对应的这条评论在style="overflow-y: scroll"里面居中显示。如果刷新页面,视频就停了。。
      

  4.   

    加个锚链接 比如 
    <a name="#4">4楼 </a> 
    然后链接这样: www.xxx.com/test.html#4 就可以定位到4楼了.