HTML 捕获window.close() 并做窗口关闭前的处理工作

时间:2014-05-15 18:08:09   收藏:0   阅读:474

转自:http://www.xinotes.net/notes/note/261/

 

bubuko.com,布布扣
 1 <html>
 2 <head>
 3 <script language="JavaScript">
 4 function beforeunload(ev) {
 5     var event = ev || window.event;
 6     event.returnValue = "Are you sure you want to close this window? "
 7                       + "All of your work will be lost if you close";
 8 }
 9 </script>
10 </head>
11 <body onbeforeunload="beforeunload(event);">
12 Try close this window.
13 </body></html>
bubuko.com,布布扣

学习一下~!~

HTML 捕获window.close() 并做窗口关闭前的处理工作,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!