单击浏览器/选项卡的关闭按钮时,请确认框 [英] Confirm box when browser/tab close button clicks

查看:74
本文介绍了单击浏览器/选项卡的关闭按钮时,请确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
当用户单击浏览器关闭按钮时,我需要进行编码以创建确认警报消息.....

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.

推荐答案

尝试一下:
警报1 [ ^ ]
警报2 [警报3 [ ^ ]
警报4 [ ^ ]
警报5 [
Try this:
Alert 1[^]
Alert 2[^]
Alert 3[^]
Alert 4[^]
Alert 5[^]


尝试一下

try this

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


使用以下代码
Use Following code
<input type="submit" value="Show" onclick="if(confirm('Are you sure ,You want to delete this?')){return true;}else{return false;}" />


这篇关于单击浏览器/选项卡的关闭按钮时,请确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆