try<SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window"> event.returnValue = "确实要退出系统?"; </SCRIPT>You cannot control the onbeforeunload much, according to MSDN,The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.
<script language="javascipt">
function my_close()
{
//you code
}
</script>
if (confirm("确定退出系统吗?"))
{
closewindow();
}
else
{
return false;
}
我按“取消”怎么还是关闭窗体???????:(
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body onbeforeunload="javascript:return false;"></body>
</html>
if (confirm("确定退出系统吗?"))
{
closewindow();<---伪代码,我已经实现了}
else
{return false;<---这是按照你的意思写的,没用}
而你的对话框显示的不是“确定退出系统吗?”而且太烦琐,:(
Dim result
result = MsgBox("你确定要退出本系统吗?", vbOKCancel, "****系统")
If result = vbOK Then
End
End If
End Sub
<body onbeforeunload="return my_close()">;
if (confirm("确定退出系统吗?"))
{
closewindow();<---伪代码,我已经实现了}
else
{ <---这个地方还不知道写什么能阻止窗口的关闭!!!}急啊!!!!!!!!!!!
主页面在加一个接收的fuction就行了
主页面再加一个接收参数的function就行了
主页面再加一个接收参数的function就行了
一个窗体,在我按下IE右上角的叉时,弹出我自己做的一个对话框,对话框上显示“确定退出系统吗?”,如果用户确定则关闭窗口,如果用户取消则不关闭窗口,就是这样。脚本的思路:
按下IE右上角的叉时触发onbeforeunload事件,事件中执行close_self()的函数,函数中有一个IF ELSE语句判断用户是否关闭窗体,弹出的是confirm的对话框 不会吧!JAVASCRIPT中连这么简单的一个操作都不能实现,还是我哪里犯了低级错误!!!????
event.returnValue = "确实要退出系统?";
</SCRIPT>You cannot control the onbeforeunload much, according to MSDN,The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.