您的位置:首页 > 其它

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

2014-08-13 14:05 232 查看
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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐