<html>
<dody>
<script language=javascript>function output()
{
var text = document.abc.text.value;
var win = window.open("","mywin", "menubar=no,width=400,height=100,resizeable=yes");
win.document.writeln("<title>输出结果</title>");
win.document.writeln("你的信息是:<p>");
win.document.writeln(text);
win.document.writeln("<input type=text name=child value=子窗口信息>");//对子窗口本身操作,使用self对象,对父窗口操作使用opener对象,这是关键
//把子窗口中表单的值回传给父窗口,取代父窗口表单以前的值,然后关闭子窗口
win.document.writeln("<input type=button value=关闭自己 onclick='window.opener.abc.text.value=self.child.value;self.close()'>");
//可以控制关闭父窗口
win.document.writeln("<input type=button value=关闭父窗口 onclick='window.opener.opener=null;window.opener.close()'>");
//刷新父窗口
win.document.writeln("<input type=button value=刷新父窗口 onclick='window.opener.location.reload()'>");win.document.close();
win.focus();
}
</script><form name=abc method=post>
<input type=text name=text size=50>
<input type=button value=提交 onclick="output()"></form></dody>
</html>