ITPub博客

首页 > IT职业 > IT图书 > 不间断滚动特效的简单测试特效代码

不间断滚动特效的简单测试特效代码

原创 IT图书 作者:chunzhisu 时间:2014-10-18 11:00:59 0 删除 编辑

点击(此处)折叠或打开

  1. <div id=\"marquee_demo\" style=\"overflow:hidden;width:500px;text-align:center;border:1px solid #ccc\">
  2. <table cellspacing=\"0\" cellpadding=\"3\" align=\"center\" border=\"0\">
  3. <tr>
  4. <td id=\"marquee_product1\" valign=\"top\">
  5. <table width=\"800\" height=\"100\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  6. <tr>
  7. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">1</td>
  8. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">2</td>
  9. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">3</td>
  10. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">4</td>
  11. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">5</td>
  12. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">6</td>
  13. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">7</td>
  14. <td width=\"180\" align=\"center\" style=\"padding:3px 15px 3px 15px;\">8</td>
  15. </tr>
  16. </table>
  17. </td>
  18. <td id=\"marquee_product2\" valign=\"top\"></td>
  19. </tr>
  20. </table>
  21. </div>
  22. <script type=\"text/javascript\">
  23. var speed=30;
  24. marquee_product2.innerHTML=marquee_product1.innerHTML;
  25. function Marquee(){
  26. if(marquee_demo.scrollLeft>=marquee_product1.scrollWidth){
  27. marquee_demo.scrollLeft=0;
  28. }
  29. else{
  30. marquee_demo.scrollLeft++;
  31. }
  32. }
  33. var MyMar=setInterval(Marquee,speed);
  34. marquee_demo.onmouseover=function(){clearInterval(MyMar);}
  35. marquee_demo.onmouseout=function(){MyMar=setInterval(Marquee,speed );}
  36. </script>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1302670/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122218