■このページのHTMLソース
<body>
<form name="form1">
<input type="button" name="subopen" value="SubWindowをOpen"
onclick="subw=window.open('frame02s.htm','','width=550,height=180,left=200,top=400');">し、このフレームを制御できます。
サブウィンドウ から書き込み表示・・→
<input type="text" name="txt" size="30">
</form>
■サブウィンドウのHTMLソース(frame02s.htm)
<SCRIPT language="JavaScript"><!--
flg1 = 1;
flg2 = 1;
function FgColor(){ //右フレームの文字色を変更
if(flg1){ //未変更の場合
window.opener.parent.main.document.fgColor = "darkgreen";
document.form1.bt1.value = "元の色に戻す";
flg1 = 0;
}else{ //変更済みの場合
window.opener.parent.main.document.fgColor = "";
document.form1.bt1.value = "呼び出し元フレームの文字色を変更";
flg1 = 1;
}
}
function InputTxt(){ //左フレームのTextBoxに表示する
window.opener.parent.main.document.form1.txt.value = document.form1.txt.value;
}
function BgColor(){ //上部フレームの背景色を変更
if(flg2){ //未変更の場合
window.opener.top.ftop.document.bgColor = "skyblue";
document.form1.bt2.value = "元の色に戻す";
flg2 = 0;
}else{ //変更済みの場合
window.opener.top.ftop.document.bgColor = "black";
document.form1.bt2.value = "背景色を変更";
flg2 = 1;
}
}
//--></SCRIPT>
</head>
<body>
<form name="form1">
<input type="button" name="bt1" value="呼び出し元フレームの文字色を変更" onclick="FgColor();"><br>
<input type="text" name="txt" size="30" onkeyup="InputTxt()">の入力が、呼び出し元のTextBoxにも即反映。<br>
左フレームのurlを「<a href="#" onclick="window.opener.parent.left.location.href='../page.htm';">ページ操作</a>]に変更<br>
上部フレームの<input type="button" name="bt2" value="背景色を変更" onclick="BgColor()">
フレームを解除し、全体に「<a href="#" onclick="window.opener.top.location.href='../../index.htm';self.close();">
ホーム(index.htm)</a>]を表示 、同時にこのサブウィンドウも閉じる。
</form>
end(01/9/19)