zoukankan      html  css  js  c++  java
  • JS简单的图片左右滚动

    <div id="scroll" style="overflow:hidden;757px;">
    <table cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td id="scroll1">
    <table>
    <tr>
    <td><a href="#"><img src="~/Images/Product/1.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/2.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/3.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/4.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/5.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/6.png" /></a></td>
    <td><a href="#"><img src="~/Images/Product/7.png" /></a></td>
    </tr>
    </table>
    </td>
    <td id="scroll2"></td>

    </tr>
    </table>
    </div>

    <script type="text/javascript">

    var sc = document.getElementById("scroll");
    var sc1 = document.getElementById("scroll1");
    var sc2 = document.getElementById("scroll2");
    sc2.innerHTML = sc1.innerHTML;
    var speed=30;
    function Marquee() {
    if (sc.scrollLeft >= sc2.offsetWidth) {
    sc.scrollLeft -= sc1.offsetWidth;
    } else {
    sc.scrollLeft++;
    }
    }
    var mar = setInterval(Marquee, speed);

    sc.onmouseover = function () { clearInterval(mar); }
    sc.onmouseout = function () { mar = setInterval(Marquee, speed);}

    </script>

  • 相关阅读:
    Gin框架系列02:路由与参数
    Gin框架系列01:极速上手
    Go语言库系列之email
    Go语言库系列之aurora
    Go语言库系列之dotsql
    Go语言库系列之flag
    Go解算法07整数反转
    Go语言micro之快速搭建微服务
    理解Golang组件protobuf
    理解Go语言组件flag
  • 原文地址:https://www.cnblogs.com/yougmi/p/3782841.html
Copyright © 2011-2022 走看看