網(wǎng)站常用的向左滾動(dòng) 首尾相接
你可以把圖片銜接的路徑改成你電腦上的就行了.寬度,長(zhǎng)度你可以自己改.
<div id="demo" style="overflow:hidden;width:600px;color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td><td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度數(shù)值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>