zoukankan      html  css  js  c++  java
  • js之侧边栏分享


    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>广告自动关闭</title>    
        </head>
        <style>
            .tip{
                position: fixed;
                top: 100px;
                left: 400px;
                display: block;
                 400px;
                height: 200px;
                border-style: dotted;
                border- thin;
                border-color: darkgreen;
                background: #f0c;
                z-index: 100;
            }
            
        </style>
        <script type="text/javascript" src="js/base.js"></script>
        <script>
            /*
            window.onload = function(){
                var timer = setInterval(function(){
                    var _span = document.getElementsByTagName("span")[0];
                    _span.innerHTML -= 1;
                    
                    if(_span.innerHTML == 0){
                        clearInterval(timer);
                        document.getElementById("ad").style.display = "none";
                    }
                },1000);
            }
            */
            
            window.onload = function(){
                var num = 5;
                var oDiv = document.getElementById("ad");
                var t = setInterval(function(){
                    countDown();
                    if(num == 0) {
                        clearInterval(t);
                        oDiv.style.display = "none";
                    }
                },1000);
            
                function countDown(){
                    oDiv.children[0].innerHTML -= 1;
                    num--;
                }
            }
        </script>
        <body>
            <div id="ad" class="tip">
                我是一条广告,谢谢!
                <span style="color:yellow; font-weight:bold;">5</span>秒钟后自动关闭
            </div>
        </body>
    </html>
    

      

     
  • 相关阅读:
    Linux
    Monkey命令
    ADB命令
    DOS命令
    列表
    函数
    文件读写及实操项目
    Selenium2自动化——初体验
    新开淘宝店怎么提升信誉,是不是真的要刷钻?
    JSFL:导入根文件夹将所有图片添加库链接导出swf
  • 原文地址:https://www.cnblogs.com/bgwhite/p/9476243.html
Copyright © 2011-2022 走看看