zoukankan      html  css  js  c++  java
  • bom-页面加载事件

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Document</title>
      <script>
        // BOM   onload  页面加载完成之后执行  
        // 页面加载完成 页面上所有的元素创建完毕,并且引用的外部资源下载完毕(js,css,图片)
        // window.onload = function () {
        onload = function () {
          var box = document.getElementById('box');
          console.dir(box);
        }
    
        // window.onunload = function () {
        // 页面卸载的时候执行
        // 
        // 
        onunload = function () {
          // 在onunload中所有的对话框都无法使用 window 对象被冻结
          // Blocked alert('欢迎下次再来') during unload.
          // alert('欢迎下次再来');
          console.log('bye bye');
        }
    
        // f5 刷新页面  
        // 1 卸载页面
        // 2 重新加载页面
        
      </script>
    </head>
    <body>
      <div id="box">
        
      </div>
      <img src="" alt="">
    
      <script>
        // 当页面上的元素创建完毕就会执行
      </script>
    </body>
    </html>
  • 相关阅读:
    HDU 1540 Tunnel Warfare (线段树区间合并)
    P2258 子矩阵
    P5021 赛道修建
    P4084 [USACO17DEC]Barn Painting
    P3914 染色计数
    比赛用模板
    P3594 [POI2015]WIL-Wilcze doły
    P5022 旅行
    P3952 时间复杂度
    P3960 列队
  • 原文地址:https://www.cnblogs.com/jiumen/p/11417825.html
Copyright © 2011-2022 走看看