Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> </head> <body onbeforeunload="return myFunction()"> <p>关闭当前窗口,按下 F5 或点击以下链接触发 onbeforeunload 事件。</p> <a href="http://www.w3cschool.cc">点击跳转到w3cschool.cc</a> <script> function myFunction() { return "我在这写点东西..."; } </script> </body> </html>