达人帮忙看下为什么这段图片无缝滚动代码只循环滚动两次就停了?
代码如下:<tr><tdheight="124"colspan="6"valign="top"><divid="demo"style="overflow:hidden;w...
代码如下:
<tr>
<td height="124" colspan="6" valign="top">
<div id="demo" style="overflow:hidden;width:781px;">
<table cellpadding="0" cellspacing="0" border="0">
<!--DWLayoutTable-->
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td> <img src="image/2zzs-d.jpg" class="biankuang1" border="0" ></td>
<td> <img src="image/2zpts.jpg" width="200" height="124" class="biankuang1" border="0"></td>
<td> <img src="image/chusha.jpg" width="200" height="124" class="biankuang1" border="0"></td>
</tr>
</table>
</td>
<td width="9" valign="top" id="demo2"></td>
</tr>
</table>
</div>
<script>
var speed=30;
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> </td>
</tr> 展开
<tr>
<td height="124" colspan="6" valign="top">
<div id="demo" style="overflow:hidden;width:781px;">
<table cellpadding="0" cellspacing="0" border="0">
<!--DWLayoutTable-->
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td> <img src="image/2zzs-d.jpg" class="biankuang1" border="0" ></td>
<td> <img src="image/2zpts.jpg" width="200" height="124" class="biankuang1" border="0"></td>
<td> <img src="image/chusha.jpg" width="200" height="124" class="biankuang1" border="0"></td>
</tr>
</table>
</td>
<td width="9" valign="top" id="demo2"></td>
</tr>
</table>
</div>
<script>
var speed=30;
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> </td>
</tr> 展开
1个回答
展开全部
我是做网页的,我虽然没有研究过关于这个的具体的代码,但是我知道,那是因为 你的 indemo的宽度造成的,因为我实验过,而且当你的宽度不合适的时候,在图片接口处会蹦一下。
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
参考资料: http://www.zdjzsj.net/index.php
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询