① 核心思路:5秒之后,就把这个广告隐藏起来
② 用定时器setTimeout()
<body> <img src="images/ad.jpg" alt="" class="ad"> <script> var ad = document.querySelector('.ad'); setTimeout(function() { ad.style.display = 'none'; }, 5000); </script> </body>
① 核心思路:5秒之后,就把这个广告隐藏起来
② 用定时器setTimeout()
<body> <img src="images/ad.jpg" alt="" class="ad"> <script> var ad = document.querySelector('.ad'); setTimeout(function() { ad.style.display = 'none'; }, 5000); </script> </body>