我试图在父窗口进入 switch 和 case 语句内的不同情况时打开一个子弹出窗口,然后在父窗口进入另一个不同情况时关闭该子窗口:
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();
}