论坛首页 入门技术论坛

js 子父窗口传值

浏览 2292 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-11-25  
a.html
--------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">

</HEAD>


<FORM action="" method=POST id=form1 name=form1>
<INPUT type="text" id=text1 name=text1>
<INPUT type="button" value="打开子窗口" name=button1 onclick="window.open('b.html','popupnav', 'width=300,height=200,resizable=0,scrollbars=auto')">
</FORM>


</HTML>

--------------------------------------------------------------------
----------------------------------b.html----------------------------
<HTML><HEAD>
<SCRIPT>
function button1_onclick() {
window.opener.form1.text1.value = document.getElementById("name").value;
window.close();
}
</SCRIPT>

</HEAD>
<BODY>
<input type="text" name="name" id="name" value="">
<INPUT type=button value="关闭" onclick="return button1_onclick()">
</BODY></HTML>

--------------------------------------------------------------------
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics