JS图片循环播放

来源:互联网 发布:红色气质微电影 知乎 编辑:程序博客网 时间:2024/04/27 06:25
<div id=demo style="overflow:hidden;height:90px;width:756px;">
           <table align=left 

cellpadding=0 cellspace=0 border=0>
             <tr>
               <td id=demo1 valign=top> <a href="http://www.abic.com.cn/ " target="_blank"> <img src="images/bn7.jpg" hspace="10" border="0"> </a> <a href="http://www.jingyagroup.com/" target="_blank"> <img src="images/bn8.jpg" hspace="10" border="0"> </a> <a href="http://www.aozhimiao.com" target="_blank"> <img src="images/bn9.jpg" hspace="10" border="0"> </a> <a href="http://www.tasly.com/ " target="_blank"> <img src="images/bn10.jpg" hspace="10" border="0"> </a> <a href="http://www.nokia.com.cn/" target="_blank"> <img src="images/bn11.jpg" hspace="10" border="0"> </a> </td>
               <td id=demo2 valign=top> </td>
             </tr>
           </table>
         </div>
       <script> 
var speed=10 
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>