zoukankan      html  css  js  c++  java
  • 案例:关闭淘宝二维码案例

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            .box {
                position: relative;
                 74px;
                height: 88px;
                border : 1px solid #cccccc;
                margin: 100px auto;
                font-size: 12px;
                text-align: center;
                color: #f40;
                /* display: block; */
            }
            .box img {
                /* position: relative; */
                 60px;
                margin-top: 5px;
            }
            .close-btn {
                position: absolute;
                top: 18px;
                left: 79px;
                 14px;
                height: 14px;
                border: 1px solid #cccccc;
                line-height: 14px;
                font-family: Arial, Helvetica, sans-serif;
                cursor: pointer;
            }
        </style>
    
    </head>
    <body>
        <div class="box">
            淘宝二维码
            <img src="OIP.jpg" alt="">
            <i class="close-btn">X</i>
        </div>
        <script>
            //1.获取元素
            var btn = document.querySelector('.close-btn');
            var box = document.querySelector('.box');
            btn.onclick = function() {
                //this 指向函数的调用者
                box.style.display = 'none';
            }
        </script>
        
    </body>
    </html>
  • 相关阅读:
    堆排序
    2019晋城一中开放日
    严格次小生成树
    遥远的国度
    noip2018游记
    Luogu1736 创意吃鱼法
    P3958 奶酪
    Luogu3385 负环
    Luogu1040 加分二叉树
    Luogu1007 独木桥
  • 原文地址:https://www.cnblogs.com/qiujie-prion/p/13024114.html
Copyright © 2011-2022 走看看