zoukankan      html  css  js  c++  java
  • 用户关闭浏览器页器,弹出一个提示

    function PageUnloader() {
        //當用戶退出時是否需要拋出一個提示
        this.UnloadTips = true;
    
        var _this = this;
    
        this.Init = function() {
            //當用戶退出時拋出一個提示
            window.onbeforeunload = function(e) { e = window.event || e; return _this.body_onbeforeunload(e); };    
        };
        
        //Unload事件, 當用戶退出時是否需要拋出一個提示
        this.body_onbeforeunload = function(e) {
            if (this.UnloadTips) {
                return "Your project has not been saved and any changes made will be lost!";
            }
        };
    }
    
    var oUnloader = new PageUnloader();
  • 相关阅读:
    最小生成树
    线段树
    编程快捷键
    线段树的动态开点
    常用库
    线性求逆元
    文件读入
    树上倍增(LCA)
    set容器
    快读与快写
  • 原文地址:https://www.cnblogs.com/yzenet/p/3910024.html
Copyright © 2011-2022 走看看