0
我试图打开一个孩子当父窗口都到了不同情况下的开关和case语句里面弹出窗口,然后当父窗口进入到另一个不同的情况下关闭该子窗口:如何从父窗口onload关闭子窗口?
case "1":
$nextDecision = "
<form action=\"index.php\" method=\"get\">
<input type=\"radio\" name=\"choice\" value=\"val1\">message<br>
<input type=\"submit\">
</form>";
?>
<script language="JavaScript" type="text/javascript" src="javascripts.js"></script>
<body onload="javascript:openWin()"></body>
<?php
break;
case "2":
$nextDecision = "
<form action=\"index.php\" method=\"get\">
<input type=\"radio\" name=\"choice\" value=\"val2\">message<br>
<input type=\"submit\">
</form>";
?>
<body onload="javascript:closeWin()"></body>
<?php
break;
javascripts.js:
function openWin() {
myWindow=window.open("file/popup.html", "name", "width=200, height=100");
}
function closeWin() {
myWindow.close();
}
我该怎么做?我会做''?并且body onload可以打开一个子窗口。所以它应该能够关闭它,对吧? – Jordan
正确!在您重新加载父项之前,U shd关闭了孩子 –
我试图检查该按钮是否在同一个switch语句中被单击,并将'openWin()'移动到该案例的开头。 ''我把这个表格放在后面,但是当我重新加载页面时,我看到弹出窗口打开,然后快速关闭。那么,弹出关闭,所以至少我们得到的地方:) – Jordan