js计时器实现轮播图
HTML部分
<div class="tu-scoll">
<div id=demo align=center>
<table border=0 align=center cellpadding=1 cellspacing=1 cellspace=0 >
<tr><td valign=top bgcolor=#ffffff id=marquePic1>
<table width='100%' border='0' cellspacing='0'><tr><td align=center><a href='#'><img src="../images/shouye1.png" width=150 height=110 border=0></a></td><td align=center><a href='#'><img src="../images/shouye2.png" width=150 height=110 border=0></a></td><td align=center><a href='#'><img src="../images/shouye3.png" width=150 height=110 border=0></a></td><td align=center><a href='#'><img src="../images/shouye4.png" width=150 height=110 border=0></a></td><td align=center><a href='#'><img src="../images/shouye5.png" width=150 height=110 border=0></a></td><td align=center><a href='#'><img src="../images/shouye6.png" width=150 height=110 border=0></a></td></tr></table>
</td><td id=marquePic2 valign=top></td></tr>
</table></div>
<i></i>
<i></i>
</div>
JS部分
<script type="text/javascript">
var speed=50
marquePic2.innerHTML=marquePic1.innerHTML
function Marquee(){
if(demo.scrollLeft>=marquePic1.scrollWidth){
demo.scrollLeft=0
}else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>