关闭的时候可以onbeforeunload()方法
我把我项目的一段拷贝给你看
//Written by Milo on Oct 22th,2010
//新增或者修改状态下离开该画面提示保存消息
window.onbeforeunload = function(){
if(editing)
{
return "离开此画面可能造成尚未保存的资料丢失。"
}
}
用 onblur 检测。 <html><title>不能最小化的窗口</title>
<body onblur='self.focus()'>
<input type="button" value="最小化" onclick="min.Click()">
<object id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Minimize">
</object>
<object id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Maximize">
</object>
</body>
</html>