无缝滚动 像左右无缝滚动的怎么做
无缝滚动 像左右无缝滚动的怎么做 好像用srcollLeft不行
无缝滚动 像左右无缝滚动的怎么做 好像用srcollLeft不行
2016-11-29
<div id="demo" style="overflow:hidden;width:600px;color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><a href="www.baidu.com"><img src="01.gif" width="120" height="100" border="0"></a>
<td>
<td><a href="www.baidu.com"><img src="02.gif" width="120" height="100" border="0"></a>
<td>
<td><a href="www.baidu.com"><img src="03.gif" width="120" height="100" border="0"></a>
<td>
<td><a href="www.baidu.com"><img src="04.gif" width="120" height="100" border="0"></a>
<td>
<td><a href="www.baidu.com"><img src="05.gif" width="120" height="100" border="0"></a>
<td><td><a href="www.baidu.com"><img src="06.gif" width="120" height="100" border="0"></a>
<td>
<td><a href="www.baidu.com"><img src="07.gif" width="120" height="100" border="0"></a>
<td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1
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>
举报