用javascript实现图片无间隙滚动

程序代码:


<base href="http://www.flash8.net">
 <div id=demo style=overflow:hidden;height:55;width:255;color:#ffffff><table align=left cellpadding=0 cellspace=0 border=0><tr>
     <td id=demo1 valign=top><img src="images/flash8.gif"><img src="images/link/flashempire.gif"><img src="images/link/deskcity.gif"><img src="http://www.blueidea.com/logo.gif">
     <td id=demo2 valign=top></td></tr></table></div>
 <script>
 var speed=30
 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>
如果您觉得我的文章有帮助,请随意赞赏!

*发表评论

用QQ账号登录  请登录后发表评论