为页面两边增加对联广告,增加关闭按钮,点击可以关闭对联 两边都关闭

 1 <body>
 2 <div id="ad1" class="ad1">
 3     <img src="http://p2.ifengimg.com/a/2017/0104/fb96dfa4d829fd1size22_w120_h164.png" style="width: 100%;height: 100%" alt="">
 4 </div>
 5 <div id="ad2" class="ad2">
 6     <button class="close" id="close">关闭</button>
 7     <img src="http://p2.ifengimg.com/a/2017/0104/fb96dfa4d829fd1size22_w120_h164.png" style="width: 100%;height: 100%" alt="">
 8 </div>
 9 <script>
10     var close=document.getElementById('close');
11     var ad1=document.getElementById('ad1');
12     var ad2=document.getElementById('ad2');
13     close.addEventListener('click',function () {
14         ad1.style.display='none';
15         ad2.style.display='none';
16     })
17 </script>
18 </body>

 

posted @ 2017-04-25 23:42  透明的月儿  阅读(176)  评论(0编辑  收藏  举报