把子窗体的信息赋值给父窗体
2006-12-31 11:33 shaofeng 阅读(312) 评论(0) 收藏 举报1.htm( 父窗体页代码)
----------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function fun()
{
window.open("2.htm","新的窗体");
}
</script>
</head>
<body>
<input type="text" id="txtupfile" value="" />
<input type="button" onclick="fun()" value="获取值" />
</body>
</html>
------------------------------
2.htm(子窗体代码)
------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function fun()
{
window.opener.document.getElementById("txtupfile").value = "info";
}
</script>
</head>
<body>
<input type="button" onclick="fun()" value="info" />
</body>
</html>
--------------------------------------------
把子窗体的信息赋值给父窗体, 试了就明白了,不用多说了吧?
打开1.htm点了就明白了~~
浙公网安备 33010602011771号