onload - 页面加载后

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function myFunction() {
  6. alert("页面已加载");
  7. }
  8. </script>
  9. </head>
  10.  
  11. <body onload="myFunction()">
  12. <h2>Hello World!</h2>
  13. </body>
  14.  
  15. </html>