zoukankan      html  css  js  c++  java
  • js跑马灯

    <!DOCTYPE html>


    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style>
            #msg {
                position:absolute;
                100px;
                background-color:blue;
                color:white;
                border:1px solid red;
            }
        </style>
        <script>
            var pos =0;
            var direction=1;
            onload = function () {
                setInterval(run, 100);
            }


            function run() {
                if (pos+100>=innerWidth) {
                    direction=-1;
                }
                if (pos<=0) {
                    direction = 1;
                }
                pos+=10*direction;

                document.getElementById('msg').style.left = pos + "px";
            }
        </script>
    </head>
    <body>
        <div id="msg">
            跑马灯文本
        </div>
    </body>
    </html>
  • 相关阅读:
    结构型模式:装饰者
    SQL Server Collatation
    实践SQLServer Tuning
    导出jar包时需指定mainclass
    垃圾回收
    web.config的部署
    控制反转与依赖注入
    Design Patterns Refcard
    实践理解计算机启动过程
    备忘录(memento)
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434725.html
Copyright © 2011-2022 走看看