<div class="htmlarea"> <textarea id="runcode83320"> <table width="250" border="0" bgcolor="F6F6F6" style="margin-top:15;border:1px solid #F2F2F2" height="150"> <tr> <td height="100px"> <div id="scrollcont" style="overflow:hidden;height:100px;" onmouseover="scrolling=1" onmouseout="scrolling=0"> <div id="scrollcont1"> My Name is tomzhou! Hello,ipaddr Hello,bcomcn My Name is tomzhou2! Hello,ipaddr2 Hello,bcomcn2 </div> <div id="scrollcont2"></div> </div> </td> </tr> </table> <script> var scrolling=0; var t=scrollcont.scrollTop; scrollcont2.innerHTML=scrollcont1.innerHTML; function scrollShow() { if (scrolling==1) return; if (scrollcont2.offsetTop-scrollcont.scrollTop<=0) scrollcont.scrollTop-=scrollcont1.offsetHeight; else scrollcont.scrollTop++; } setInterval(scrollShow,50); </script> </textarea><br><input onclick="runEx('runcode83320')" type="button" value="运行代码"> <input onclick="doCopy('runcode83320')" type="button" value="复制代码"> <input onclick="doSave(runcode83320)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br>其中,100px是滚动区域的高度,宽度由scrollcont的外面容器决定,setInterval里面的50决定滚动的速度。 <br>