我有一个页面里面的内容是打印机效果,内容一行一行显示,但是不会向下滚动;我又用了一个JavaScript 让他向下滚动<script>function Gun(){
scrollBy(0,1);//移动到y999999,但是没那么高,就默认最底了
window.setTimeout("Gun()", 10);//10毫秒后打开 Gun()
}
Gun()//第一次打开
</script>但是 页面内容显示完后 无法向上拉滚动条 一拉 他还 自动向下滚动,
怎么办啊

解决方案 »

  1.   


    var Gun=function() {
        scrollBy(0,1);
        if(document.documentElement.scrollTop==document.documentElement.scrollHeight-document.documentElement.clientHeight)//如果页面没有使用dtd,把documentElement换成body
            clearInterval(it);
    }
    var it=setInterval(Gun,10);
      

  2.   

    估计楼主需要下面的代码:
    <script style="javascript/text">
     
    var currentpos,timer; function initialize() 

    timer=setInterval("scrollwindow()",10); 

    function sc(){ 
    clearInterval(timer); 

    function scrollwindow() 

    currentpos=document.body.scrollTop; 
    window.scroll(0,++currentpos); 
    if (currentpos != document.body.scrollTop) 
    sc(); 

    document.onLoad=initialize() ;
    </script>
      

  3.   

    能不能把这个 JavaScript 改成 运行五分钟后失效?
    <script>function Gun(){
        scrollBy(0,1);//移动到y999999,但是没那么高,就默认最底了
        window.setTimeout("Gun()", 10);//10毫秒后打开 Gun()
    }
    Gun()//第一次打开
    </script>