本文介绍了单击浏览器/选项卡的关闭按钮时,请确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
当用户单击浏览器关闭按钮时,我需要进行编码以创建确认警报消息.....
Javascript编码对我更有用....
谁能帮我.
Hello to all
I need coding to create confirm alert message when user clicks a browser close button..........
Javascript coding is more helpful to me....
Can anyone help me.
推荐答案
window.onunload = function () {
var r = confirm( "Press a button!" )
if ( r == true ) {
alert( "You pressed OK!" )
}
else {
alert( "You pressed Cancel!" )
}
};
参见参考资料
window.onunload
see reference
window.onunload
<input type="submit" value="Show" onclick="if(confirm('Are you sure ,You want to delete this?')){return true;}else{return false;}" />
这篇关于单击浏览器/选项卡的关闭按钮时,请确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!