<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> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
【责任编辑: lanier】