美文网首页webAPI
关闭二维码

关闭二维码

作者: 椋椋夜色 | 来源:发表于2019-05-10 22:45 被阅读0次

<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title> 关闭二维码 </title>

<style>
    .box {
        width: 107px;
        height: 127px;
        position: fixed;
        left: 50%;
        top: 50%;
        margin-left: -53.5px;
        margin-top: -63.5px;
        border: 1px solid #d9d9d9;
    }

    span {
        width: 15px;
        height: 15px;
        position: absolute;
        left: -16px;
        top: 0;
        border: 1px solid #d9d9d9;
        font-size: 12px;
        text-align: center;
        line-height: 15px;
        color: #d9d9d9;
        cursor: pointer;
    }
</style>

</head>

<body>

<div class="box">
    <img src="../images/taobao.jpg" alt="">
    <span id="close">X</span>
</div>


<script>
    //给span加点击事件
    document.getElementById('close').onclick = function () {
        // parentNode 找到父节点
        this.parentNode.style.display = "none";
    };
</script>

</body>

</html>

相关文章

网友评论

    本文标题:关闭二维码

    本文链接:https://www.haomeiwen.com/subject/eozzoqtx.html