親ウィンドウが 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();
}