新しい問い合わせ用の窓を開いて
入力された値を元のテキスト入力フォームに返す
っていうサンプルを作りました。
親フォーム
----------
<html>
<title>小窓を開く</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function openWin(url) { return false;
}
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!--
var w = window;
function openWin(url) { if ((w == window) || w.closed) { w = open(url, "_blank", "width=300,height=300"); } else { w.focus(); } return(false);
}
// -->
</SCRIPT>
<body>
<form name="form1">
<A HREF="chi_window.html" onClick="return openWin('chi_window.html')">
[開く]</A>
<input type="text" name="example1" />
<input type="text" name="example2" />
</form>
</body>
</html>
-
子 chi_window.html
-
<html>
<script language="JavaScript">
function color1(){ window.opener.document.form1.example1.value = test1.value; window.opener.document.form1.example2.value = test2.value; window.close();
}
</script>
<body>
DATA1:<input type="text" id = test1 name="example1"><br>
DATA2:<input type="text" id = test2 name="example2"><br>
<INPUT TYPE=BUTTON VALUE="送信" onClick="color1()">
</body>
</html>
-