简单的不间断的滚动特效,需要注意的问题:marquee_demo这个宽度一定要小于含有滚动内容的那个table的宽度,否则将不滚动
<div id="marquee_demo" style="overflow:hidden;width:500px;text-align:center;border:1px solid #ccc">
<table cellspacing="0" cellpadding="3" align="center" border="0">
<tr>
<td id="marquee_product1" valign="top">
<table width="800" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">1</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">2</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">3</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">4</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">5</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">6</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">7</td>
<td width="180" align="center" style="padding:3px 15px 3px 15px;">8</td>
</tr>
</table>
</td>
<td id="marquee_product2" valign="top"></td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=30;
marquee_product2.innerHTML=marquee_product1.innerHTML;
function Marquee(){
if(marquee_demo.scrollLeft>=marquee_product1.scrollWidth){
marquee_demo.scrollLeft=0;
}
else{
marquee_demo.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
marquee_demo.onmouseover=function(){clearInterval(MyMar);}
marquee_demo.onmouseout=function(){MyMar=setInterval(Marquee,speed);}
</script>
.
TAG: 特效 代码 滚动