图片水平滚动


 <div id="demo" style="overflow: hidden; WIDTH:100%; valign:middle;">
           <table cellspacing=0 cellpadding=0 align=left border=0
        cellspace="0">
        <tr>
         <td valign="middle" id="demo1">
            图片的位置<image src=""/><image src=""/>
<image src=""/>

         </td>
         <td id="demo2" valign="middle"></td>
        </tr>
       </table>
               </div>


<SCRIPT>  
  var speed=50;
  document.getElementById("demo2").innerHTML= document.getElementById("demo1").innerHTML;
  function Marquee(){
  if( document.getElementById("demo2").offsetWidth- document.getElementById("demo").scrollLeft<=0)
   document.getElementById("demo").scrollLeft-= document.getElementById("demo1").offsetWidth
  else{
   document.getElementById("demo").scrollLeft++
  }
  }
  var MyMar=setInterval(Marquee,speed)
   document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
   document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
  </SCRIPT>

你可能感兴趣的:(图片水平滚动)