【读书笔记】 网页关闭确认框

关键部分用粗黑体。
function goodbye(e) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } window.onbeforeunload=goodbye;
posted @ 2015-07-30 17:01  WFE-Hank  阅读(164)  评论(0编辑  收藏  举报