窗体之间的交互(window.opener)

窗体之间的交互(window.opener)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
    <script language="javascript" type="text/javascript">
        function openwindow()
        {
            window.open("OpenerWindow.htm","newwin","height=300,width=500,top=100,left=100resizable=yes");
        }
    </script>
</head>
<body>
    <form name="form1" action="" method="post">
        <input name="text1" />
        <input type="button" onclick="openwindow()" value="Open New Window" />
    </form>
</body>
</html>

第二个页面
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
     <script language="javascript" type="text/javascript">
          function getText() {
            document.form1.text1.value = window.opener.document.form1.text1.value;
          }
    </script>
</head>
<body onload="getText()">
    <form name="form1" action="" method="post">
        <input name="text1" />
    </form>
</body>
</html>

原文地址:https://www.cnblogs.com/chengpeng/p/2146040.html