一段项目中用的js操作表格滚动的代码,可以每滚动一行停顿几秒钟!非常不错!
<div id="mq" style="width:490px;height:240px;overflow:hidden" onMouseOver="iScrollAmount=0"οnmοuseοut="iScrollAmount=1" >滚动内容,表格数据</div>
<script>var oMarquee = document.getElementById("mq"); //滚动对象var iLineHeight = 24; //单行高度,像素var iLineCount = 18; //实际行数var iScrollAmount = 1; //每次滚动高度,像素function run() {oMarquee.scrollTop += iScrollAmount;if ( oMarquee.scrollTop == iLineCount * iLineHeight )oMarquee.scrollTop = 0;if ( oMarquee.scrollTop % iLineHeight == 0 ) {window.setTimeout( "run()", 2000 );} else {window.setTimeout( "run()", 50 );}}oMarquee.innerHTML += oMarquee.innerHTML;window.setTimeout( "run()", 2000 );</script>
大家拿到代码可以设置参数自己调试一下,挺不错的!
有问题可以留言!