Javascript 强制鼠标单击弹出窗口
我有一个简单的项目,但我是javascript新手, 我需要的是在用户离开页面时强制鼠标单击对话框 如何执行此操作?查看“卸载”事件;) 在卸载呼叫中,您只需呼叫Javascript 强制鼠标单击弹出窗口,javascript,Javascript,我有一个简单的项目,但我是javascript新手, 我需要的是在用户离开页面时强制鼠标单击对话框 如何执行此操作?查看“卸载”事件;) 在卸载呼叫中,您只需呼叫 confirm('Are you sure ?'); 或者像“onbeforeunload”中所说的,若你们想在页面中使用对象 function goodbye(e) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this wil
confirm('Are you sure ?');
或者像“onbeforeunload”中所说的,若你们想在页面中使用对象
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;
您需要使用附加了以下窗口的事件“onbeforeunload”: 我认为最好使用“onbeforeunload”使文档中的所有对象保持活动状态