请问使用marquee能够控制图片连续,无空隙滚动吗?
展开全部
能,好多种方法!
<div id="demo" style="overflow:hidden;width:500px;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><img src="images/tp1.jpg" /></td>
<td><img src="images/tp2.jpg" /></td>
<td><img src="images/tp3.jpg" /></td>
</tr>
</table></td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft--
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
<div id="demo" style="overflow:hidden;width:500px;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><img src="images/tp1.jpg" /></td>
<td><img src="images/tp2.jpg" /></td>
<td><img src="images/tp3.jpg" /></td>
</tr>
</table></td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft--
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询