DIV CSS JS實作不間斷橫向捲動程式碼 複製程式碼 程式碼如下: 横向不间断滚动DIV CSS代码-DIVCSS5 <br>.scroll_div {width:600px; height:49px;margin:0 auto; overflow: hidden; white-space: nowrap; background:#ffffff;} <br>.scroll_div img {width:120px;height:49px;border: 0;margin: auto 8px; } <br>#scroll_begin, #scroll_end, #scroll_begin ul, #scroll_end ul, #scroll_begin ul li, #scroll_end ul li{display:inline;}/* 设置ul和li横排 */ <br> <br>function ScrollImgLeft(){ <br>var speed=20 <br>var scroll_begin = document.getElementById("scroll_begin"); <br>var scroll_end = document.getElementById("scroll_end"); <br>var scroll_div = document.getElementById("scroll_div"); <br>scroll_end.innerHTML=scroll_begin.innerHTML <br>function Marquee(){ <br>if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0) <BR>scroll_div.scrollLeft-=scroll_begin.offsetWidth <BR>else <BR>scroll_div.scrollLeft++ <BR>} <BR>var MyMar=setInterval(Marquee,speed) <BR>scroll_div.onmouseover=function() {clearInterval(MyMar)} <BR>scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)} <BR>} <BR> DIVCSS5演示说明:向左滚动 ScrollImgLeft();