本文介绍了关闭窗口时如何显示警报消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复: 如何防止关闭浏览器窗口?
Possible Duplicate: How to prevent closing browser window?
我想显示一个带有注销按钮的警告消息请在关闭窗口之前注销",当用户尝试关闭窗口并且单击注销按钮后,可以关闭窗口.如何实现呢?
I want to show an alert message "Please logout before closing the window" with an logout button, when an user tries to close the window and after clicking on logout button the window can be closed. How to achieve this?
推荐答案可以尝试的另一种实现方式:
Another implementation you can try:
<html> <head> <script type="text/javascript"> window.onbeforeunload = function() { return "Did you save your stuff?" } </script> </head> <body> </body> </html>更多推荐
关闭窗口时如何显示警报消息?
发布评论