首页 > 其他 > 详细

用户关闭浏览器页器,弹出一个提示

时间:2014-08-13 14:53:06      阅读:323      评论:0      收藏:0      [点我收藏+]
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();

 

用户关闭浏览器页器,弹出一个提示,布布扣,bubuko.com

用户关闭浏览器页器,弹出一个提示

原文:http://www.cnblogs.com/yzenet/p/3910024.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!