CSDN博客

img mingmingsuper

父窗体从子窗体获取值

发表于2008/9/28 14:37:00  524人阅读

分类: js学习

 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' onclick='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='关闭' onclick='window.opener.document.f1.ft.value=document.fz.tt.value;self.close();' />
</form>
</div>
</body>
</html>

阅读全文
0 0

相关文章推荐

img
取 消
img