zoukankan      html  css  js  c++  java
  • JS不间断向左滚动代码

    <div id="demo" style="overflow:hidden;" class="hz1">
    	<table border="0" align="center" style=" padding-left:10px; padding-top:5px;"  >
    	<tr>
        <td valign="top" id="marquePic1">
    	<table width='100%'>
        <tr>
        
        <td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/20020120524999.gif" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/91920120525133.jpg" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/41620120525886.gif" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/19220120525906.jpg" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/75620120525449.gif" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/7532012052598.jpg" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.baidu.com' target="_blank"><img src="upfile/linkpic/69220120525269.jpg" width='110' height='50' border='0'><br>宏达地板</a></td><td align='center' ><a href='http://www.shijihongda.cn' target="_blank"><img src="upfile/linkpic/38620120529968.gif" width='110' height='50' border='0'><br>宏达装饰</a></td><td align='center' ><a href='http://www.shijihongda.cn' target="_blank"><img src="upfile/linkpic/23120120529125.gif" width='110' height='50' border='0'><br>宏达装饰</a></td>
        </tr>
        </table>
        </td>
        <td id="marquePic2" valign="top"></td>
        </tr>
    	</table>
        </div>
    
    <script type="text/javascript"> 
        var speed = 20; //速度数值越大速度越慢
        var marquePic2 = document.getElementById("marquePic2");
        var marquePic1 = document.getElementById("marquePic1");
        var demo = document.getElementById("demo");
        marquePic2.innerHTML = marquePic1.innerHTML
        function Marquee() {
     
            if (marquePic2.offsetWidth - demo.scrollLeft <= 0)//offsetWidth 是对象的可见宽度
                demo.scrollLeft -= marquePic1.offsetWidth; //scrollWidth 是对象的实际内容的宽,不包边线宽度
            else {
                demo.scrollLeft++
            }
     
        }
        var MyMar = setInterval(Marquee, speed)
        demo.onmouseover = function () { clearInterval(MyMar) }
        demo.onmouseout = function () { MyMar = setInterval(Marquee, speed) } 
    </script>
    
  • 相关阅读:
    Android反射打造万能SharedPreferences
    Android 通过反射让SQlite建表
    Android--Listview优化
    Android Touch事件传递机制
    [转]Android 完美的隐藏软键盘方法 点击编辑框外软键盘消失
    Android之异步线程原理
    Android应用性能优化之使用SparseArray替代HashMap
    在xocde运行profile 遇到"Existing default base temp directory '/Library/Caches/com.apple.dt.instruments' has insufficient privileges for user id 505. Please have the owner delete this directory"
    UITableView——点击某一行移动到指定位置
    CocoaPods看的三篇文章
  • 原文地址:https://www.cnblogs.com/jkyweb/p/2526524.html
Copyright © 2011-2022 走看看