网页广告

Posted on 2017-07-16 20:14  君莫笑~  阅读(137)  评论(0)    收藏  举报

点击图片中的关闭图片会消失,并且是点哪一张哪一张消失,不会同时消失,点击刷新又会出现。(代码在图片下发)

 <style>
        .GuangGao {
            margin-left: 100px;
            margin-top: 250px;
            position: fixed;
            z-index: 99;
            position: absolute;
        }
        
        .GuangGao img {
            width: 220px;
            height: 220px;
        }
        
        .GuangGao2 {
            margin-left: 100px;
            /*margin-top: -165px;*/
            position: fixed;
            z-index: 99;
            position: absolute;
        }
        
        .GuangGao2 img {
            width: 220px;
            height: 220px;
        }
    </style>

</head>

<body>

    <div class="GuangGao" id="hide"><a href="#">关闭&nbsp;x</a>
        <a href="#"><img src="imgs/8.jpg" alt="广告"></a>
    </div>
    <div class="GuangGao2" id="hide2"><a href="#">关闭&nbsp;x</a>
        <a href="#"><img src="imgs/9.jpg" alt="广告"></a>
    </div>

</body>

<script type="text/javascript" src="jquery-easyui-1.5.2/jquery.min.js"></script>(引用,需下载)

<script type="text/javascript">
    $(document).ready(function() {
        $("#hide").click(function() {
            $("#hide,.div").hide();
        });
    });

    $(document).ready(function() {
        $("#hide2").click(function() {
            $("#hide2,.div").hide();
        });
    });
</script>