在a.html用window.open打开b.htmlb可得到opener对象,这个opener就是指到a.html的window对象

解决方案 »

  1.   

    a.htm  
     
    onclick="window.open('b.htm','')"
    文本框ProductImage
    B.htmwindow.opener.form.ProductImage.value='<%=filename%>';
      

  2.   

    我的a.html
    <script>
       function open2(){
          window.open("b.htm","ceshi","height=350,width=350");
       }
    </script>
    <body>
     <form name="form2"action="" method="get">
     <input name="aa" type="text">
     <input name="a" type="button" value="open2" onClick="open2()">
     </form>
    </body>b.html<script>
       function guanbi(){
         window.opener.form.ProductImage.value = document.form1.aa.value;
        alert(document.form1.aa.value);
      window.close();
       }
    </script>
    <body>
     <form name="form1"action="" method="get">
     <input name="aa" type="text">
     <input name="a" type="button" value="closed" onClick="guanbi()">
     </form>
    </body>请哪个高人帮我看下哪里错了。
      

  3.   

    b.htm
    <script>
       function guanbi(){
         window.opener.form2.aa.value = document.form1.aa.value;
        alert(window.opener.form2.aa.value);
      window.opener=null;
      window.close();
       }
    </script>
    <body>
     <form name="form1"action="" method="get">
     <input name="aa" type="text">
     <input name="a" type="button" value="closed" onClick="guanbi()">
     </form>
    </body>
      

  4.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function setValue(){
    document.Form1.txt1.value= "changed" ;
    newoption = new Option("changed","changed");
    document.Form1.sel1.add(newoption);
    }function openWin(){ objWin = window.open('','');
    objWin.document.open();
    objWin.document.write ("<body bgcolor=#cccccc></body>");
    objWin.document.write ("<input type='button' value='SetValue' onclick='opener.setValue();window.opener=null;window.close()'>");
    objWin.document.write ("<input type='button' value='CloseMe' onclick='if(opener.closed){window.opener=null;window.close()}'>");
    objWin.document.close;
    }
    //-->
    </SCRIPT>
    </HEAD><BODY>
    <FORM name="Form1" METHOD=POST ACTION="">
    <INPUT TYPE="text" NAME="txt1" value="default">
    <INPUT TYPE="button" NAME="abc" onclick="openWin()" value="openWin">
    <select name="sel1"></select>
    </FORM>
    </BODY>