<!DOCTYPE html>charset="utf-8"W3Cschool在线教程(w3cschool.cn)该实例演示了如何使用 HTML DOM 向 body 元素添加 "onbeforeunload" 事件。关闭当前窗口,按下 F5 或点击以下链接触发 onbeforeunload 事件。href="http://www.w3cschool.cn"点击调整到W3Cschool在线教程window.onbeforeunload = function(event) {event.returnValue = "我在这写点东西...";};