1.父窗体:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>父窗体</title>
</head>
<body>
<form name="f1" action='#' method='get'>
<input type=text name='ft' value=''>
<input type='button' οnclick='openWindow()' / value="弹出">
</form>
<script type="text/javascript">
<!--
function openWindow() {
newWindow = window.open('child.html','newWindow','height=300,width=300,scrollbars=auto');
if (newWindow != null) {
newWindow.focus();
}
}
//-->
</script>
</select>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>父窗体</title>
</head>
<body>
<form name="f1" action='#' method='get'>
<input type=text name='ft' value=''>
<input type='button' οnclick='openWindow()' / value="弹出">
</form>
<script type="text/javascript">
<!--
function openWindow() {
newWindow = window.open('child.html','newWindow','height=300,width=300,scrollbars=auto');
if (newWindow != null) {
newWindow.focus();
}
}
//-->
</script>
</select>
</body>
</html>
子窗体:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>这是子窗口</title>
</head>
<body>
<h1 align='center'>这是子窗口!</h1><hr>
<div align='center'>
<form name="fz" action='#' method='get'>
<input type=text name='tt'>
<input type='button' value='关闭' οnclick='window.opener.document.f1.ft.value=document.fz.tt.value;self.close();' />
</form>
</div>
</body>
</html>