asp.net 子父窗口 传值

来源:互联网 发布:野村周平水原希子 知乎 编辑:程序博客网 时间:2024/06/06 00:36

父窗口

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>无标题文档</title>
<script language="javascript">
function openSub()
{
   window.open("新建 文本文档 (2).html",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
}

</script>
</head>

<body>
<form name="frm0">

<input type="text" id="txtId" />
    <input type="button" onclick="openSub();" value="打开子窗口" />
    </form>
</body>
</html>

 

子窗口

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2123" />
<title>无标题文档</title>
<script language="javascript">
   function setValue()
   {
    window.opener.document.getElementById("txtId").value=window.self.document.getElementById("dd").value;
    window.close();
   }
</script>
</head>

<body>
<form name="frm">
我是子窗口
<input type="button" onclick="setValue();" value="赋值"/>
<input type="text" id="dd" value="赋值"/>
</form>
</body>
</html>
 

 

 

原创粉丝点击