案例分析:
1. 5s之后就把广告因擦擦那个起来;
2. 用定时器setTimeout;
代码:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body> 8 <img src="图片/ad.jpg" alt="ad"> 9 <script> 10 var ad = document.querySelector('img'); 11 setTimeout(function(){ 12 ad.style.display = 'none'; 13 },5000) 14 </script> 15 </body> 16 </html>