87,915
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<script language="JavaScript">
var newWindow;
function createNewWindow()
{
newWindow=window.open("B.html","_blank","height=300,width=300");
}
function closeNewWindow()
{
if(newWindow)
{
newWindow.newWindow.close();
newWindow.close();
newWindow=null;
newWindow=null;
}
}
</script>
</head>
<body onunload="closeNewWindow()">
<form>
<input type="button" value="点击创建新窗口" onclick="createNewWindow()"/>
<input type="button" value="关闭新窗口" onClick="closeNewWindow()"></input>
</form>
</body>
</html>
<html>
<head>
<script language="JavaScript">
var newWindow;
function createNewWindow()
{
newWindow=window.open("C.html","_blank","height=300,width=300");
}
function closeNewWindow()
{
if(newWindow)
{
newWindow.close();
newWindow=null;
}
}
</script>
</head>
<body onunload="closeNewWindow()">
<h1>子页</h1>
<form>
<input type="button" value="点击创建新窗口" onclick="createNewWindow()"/>
<input type="button" value="关闭新窗口" onClick="closeNewWindow()"></input>
</form>
</body>
</html>
子子页