有关Window closed状态判断的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
<!--
var newWindow;
function makeNewWindow()
{
newWindow = window.open("", "", "status, height=300, width=300");
}
function subWrite()
{
if(newWindow.closed)
{makeNewWindow();
}
newWindow.focus();
var newContent = "<html><head><title>New Document</title></head>";
newContent += "<body><bgcolor='aqua'><h1>This document is new.</h1>";
newContent += "</body></html>";
newWindow.document.write(newContent);
newWindow.document.close();
}
//-->
</script>
</head>
<body onload="makeNewWindow()">
<form>
<input type="button" value="make new window" onclick="subWrite()" />
</form>
</body>
</html>
运行时,为什么总是说“newWindow.closed”有问题?请问如何判断一个窗口是否 已关闭?
问题点数:20、回复次数:1Top
1 楼net_lover(【孟子E章】)回复于 2006-03-20 22:43:54 得分 0
var newWindow = null
if(newWindow && newWindow.open && !newWindow.closed)
newWindow.focus()
else
makeNewWindow()Top




