87,910
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>第一个页面</title>
</head>
<body>
<form id="form1" name="form1" action="22.htm" method="post" target="_blank">
<input type="submit" value="submit">
</form>
</body>
</html>
<html>
<head>
<title>第二个页面</title>
<script language="javascript">
function closeWin()
{
alert("关闭");
window.close();
//能否先闭窗口,再弹出对话框
}
</script>
</head>
<body>
<form id="form2" name="form2">
<input type="button" value="close" onclick="closeWin()">
</form>
</body>
</html>
==
第二个页面能否先闭窗口,再弹出对话框
<html>
<head>
<title>第一个页面</title>
</head>
<body>
<form id="form1" name="form1" action="3.asp" method="post" target="_blank">
<input type="submit" value="submit">
</form>
</body>
</html>
<script language="JavaScript">
var bb;
window.onload=function()
{
time=window.setInterval(function(){ if (bb=="true"){alert("关闭");clearInterval(time);}},1000)
}
</script>
<html>
<head>
<title>第二个页面</title>
<script language="javascript">
function closeWin()
{
window.close();
//能否先闭窗口,再弹出对话框
}
</script>
</head>
<body>
<form id="form2" name="form2">
<input type="button" value="close" onclick="window.opener.bb='true';closeWin()">
</form>
</body>
</html>
<html>
<head>
<title>第二个页面</title>
<script language="javascript">
function closeWin()
{
window.close();
//能否先闭窗口,再弹出对话框
}
function showAlert()
{
alert("关闭");
//能否先闭窗口,再弹出对话框
}
</script>
</head>
<body onunload="showAlert();">
<form id="form2" name="form2">
<input type="button" value="close" onclick="closeWin()">
</form>
</body>
</html>