第1个回答 2010-06-13
<html>
<head>
</head>
<body>
<script type="text/javascript">
window.onbeforeunload = function(e){
return confirm("是否关闭窗口");
}
</script>
</body>
</html>
这个是多个浏览器都支持的版本
<html>
<head>
</head>
<body>
<script type="text/javascript">
window.onbeforeunload = function(e){
if(window.event)
window.event.returnValue = "关闭窗口";
return false;
}
</script>
</body>
</html>
这个版本呢在Firefox下面就没有自定义的提示信息了。。。本回答被提问者和网友采纳
第2个回答 2015-11-12
<html>
<head>
</head>
<body>
<script type="text/javascript">
window.onbeforeunload = function(e){
return confirm("是否关闭窗口");
}
</script>
</body>
</html>
这个是多个浏览器都支持的版本
<html>
<head>
</head>
<body>
<script type="text/javascript">
window.onbeforeunload = function(e){
if(window.event)
window.event.returnValue = "关闭窗口";
return false;
}
</script>
</body>
</html>
第3个回答 2010-06-11
<script language="javascript">
window.onbeforeunload= function(){
window.event.returnValue = "感谢您的使用,再见!"
if (window.event.reason == false){
window.event.cancelBubble = true;
}
};
</script>
第4个回答 2010-06-11
<HTML><body>
<script type = "text/javascript" language = "javascript">
function cf1()
{
if(confirm("点确定关闭本窗口!")) {
window.close();
}
}
</script>
<a href="#" onclick="cf1();">Click Me to Test!</A>
</BODY>
</HTML>