1 <!DOCTYPE html> 2 <html> 3 <head lang="en"> 4 <meta charset="UTF-8"> 5 <title></title> 6 <style> 7 .box { 8 1210px; 9 height: 80px; 10 margin: 0 auto; 11 background-color: pink; 12 } 13 </style> 14 </head> 15 <body> 16 <div class="box"></div> 17 18 19 <script> 20 21 var div = document.getElementsByTagName("div")[0]; 22 div.onclick = function () { 23 this.style.display = "none"; 24 } 25 26 </script> 27 </body> 28 </html>