showModalDialog 关闭提示信息

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Confirm Before Leave</title>
<script language="javascript" type="text/javascript"><!--
var pb_strConfirmCloseMessage;
var pb_blnCloseWindow = false;
pb_strConfirmCloseMessage ="确定要放弃当前的修改?";

function ConfirmClose()
{
window.event.returnValue = pb_strConfirmCloseMessage;
pb_blnCloseWindow = true;
}
function ShowConfirmClose(blnValue)
{
if(blnValue)
{
   document.body.onbeforeunload = ConfirmClose; //设置为提示
}
else
{
   document.body.onbeforeunload = null;//设置为不提示
}
}

function SelectHotel()
{
window.showModalDialog('00.htm',window,'scroll=no;resizable=no;help=no;status=no;dialogHeight=470px;dialogwidth=250px')
}
//--></script>
</head>
<body onload="ShowConfirmClose(true);">
<p>
<input type=button value="提示" onclick="ShowConfirmClose(true);">
<input type=button value="不提示" onclick="ShowConfirmClose(false);">
<input type=button value="测试刷新" onclick="window.location.reload();">
</p>
<p>
<input type="button" name="Submit" value="showModalDialog" onClick="SelectHotel();">
</p>
</body>
</html>

 

 

 

00。htm

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var pb_strConfirmCloseMessage;
var pb_blnCloseWindow = true;
pb_strConfirmCloseMessage ="确定要放弃当前的修改?";

function ConfirmClose()
{
window.event.returnValue = pb_strConfirmCloseMessage;
}

 

function ShowConfirmClose(blnValue)
{
if(blnValue)
{
   document.body.onbeforeunload = ConfirmClose; //设置为提示
}
else
{
   document.body.onbeforeunload = null;//设置为不提示
}
}

//-->
</SCRIPT>
<body onload="ShowConfirmClose(true);">

     00.htm
</body>
</HTML>

你可能感兴趣的:(JavaScript,html)