zoukankan      html  css  js  c++  java
  • JS页面上的流氓广告功能

    <style>
    * {
    margin: 0;
    padding: 0;
    }
    .panel {
    position: fixed;
    right: 0;
    bottom: 0;
    200px;
    height: 200px;
    line-height: 200px;
    text-align: center;
    background-color: skyblue;
    }
    .close {
    position: absolute;
    right: 0;
    top: -30px;
    30px;
    height: 30px;
    background-color: black;
    color: white;
    line-height: 30px;
    cursor: pointer;
    }
    </style>

    </head>
    <body>

    <div class="panel">
    <div class="close">&times;</div>
    <span>流氓广告</span>
    </div>
    <script>
    // 获取元素
    // 根据类名 获取所有的类中包含的元素集合
    var panelCollection = document.getElementsByClassName("panel");
    // 根据下标 获取对应的元素
    var panel = panelCollection[0];

    // 根据类名 获取关闭按钮
    var closeCollection = document.getElementsByClassName("close");
    // 根据下标 获取对应的元素
    var close = closeCollection[0];

    // 当点击close时,要让panel消失
    close.onclick = function() {
    panel.remove();
    // 此时开始计时 一定时间之后 再让它出现
    setTimeout(function() {
    document.body.appendChild(panel);
    }, 1000);
    }


    </script>
  • 相关阅读:
    016_异步处理_Future
    013_REST Service
    012_介绍Soap&Rest
    011_Validation Rule about Time
    010_Soap update
    006_Salesforce Sharing 使用说明
    005_重写 Standard Delete Button
    004_Intelij 使用,Anonymous Apex
    003_关于IntellJ IDE 2016 1. 4的使用
    Dashborad 上显示出错
  • 原文地址:https://www.cnblogs.com/zz22/p/11436922.html
Copyright © 2011-2022 走看看