<div style="position:absolute;top:0px;left:0px;width:80%;height:400px;overflow:scroll;border:solid 1px green" id="t1"></div>t1的DIV元素有一个属性scrollTop属性是数值型的可读写的,你可以动态改变此值以实现你要做的事。刚刚我用while(true){
  t1.scrollTop++;
}这代码来一试,果然在滚动
不过你也应该知道死掉了啊哈哈

解决方案 »

  1.   

    var interval;
    function scl(obj){
      obj.scrollTop++;
    }function sc(obj){
      interval=setInterval(function(){scl(obj);},50);
    }function ce(){
      window.clearInterval(interval);
    }<div style="position:absolute;top:0px;left:0px;width:80%;height:400px;overflow:scroll;border:solid 1px green" id="t1" ondblclick="sc(this);" onclick="ce();"></div>整个就应该这样吧
    不过这段我空手写的未经测试哦
      

  2.   

    不影响楼上的得分。仅供代码交流:<br>
    双击滚动,点击停止:<br>
    <div id=marqueeDiv3 nowrap style="Height:200;overflow:auto;background-color:#cccccc;" speed=2 onclick="window.clearInterval(this.interval)" ondblclick="this.interval=window.setInterval('marqueeDiv3.scrollTop+=marqueeDiv3.speed*1;',20);">
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div>
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div>
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div></div>
    <br>
    双击滚动,点击停止:<br>
    <div id=marqueeDiv4 nowrap style="Height:200;overflow:auto;background-color:#cccccc;" speed=2 onclick="window.clearInterval(this.interval)" ondblclick="this.interval=window.setInterval('marqueeDiv4.scrollTop+=marqueeDiv4.speed*1;',20);">
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div>
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div>
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    </div></div>