js gundong

<div id="demo" style="overflow:hidden;height:210;width:560;color:#ffffff"><table align="left" cellpadding="0" cellspace="0" border="0"><tr><td id="demo1" valign="top"><table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="indexgd/001.gif" width="143" height="200"/></td><td><img src="indexgd/002.gif" width="143" height="200"/></td><td><img src="indexgd/003.gif" width="143" height="200"/></td><td><img src="indexgd/004.gif" width="143" height="200"/></td><td><img src="indexgd/005.gif" width="143" height="200"/></td><td><img src="indexgd/006.gif" width="143" height="200"/></td><td><img src="indexgd/007.gif" width="143" height="200"/></td><td><img src="indexgd/008.gif" width="143" height="200"/></td></tr></table></td><td id="demo2" valign="top"></td></tr></table></div><script>var speed=8//速度数值越大速度越慢 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) demo.onmouseover=function(){clearInterval(MyMar)} demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)} </script>

posted @ 2012-09-11 16:05  rayray2  阅读(174)  评论(0编辑  收藏  举报