从你的问题本身来看,虽然你已经有思路了,但我还是建议你用showModalDialog来做这个功能。showModalDialog本身就是针对这个功能而设计的

解决方案 »

  1.   

    1.html:
    ----------------------------
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    function aa(obj){
        var w = window.showModalDialog("2.html");
    document.form1.a.value=w;
    }</script>
    </head><body>
    <form name=form1>
    <input type=text name="a" value="">
    <input type=button name=button1 value=button1 onclick="aa();">
    </form>
    </body>
    </html>
    2.html:
    ------------------------------------<HTML>
    <HEAD>
    <script>
     function onOK()
     {
    window.returnValue=document.form1.a.value;
    window.close()
     }
    </script>
    </HEAD>
    <BODY onload="">
    <form name=form1>
    <input type=text name=a>
    <input type=button onclick="onOK()" value=button>
    <form>
    </BODY>
    </HTML>
      

  2.   

    NS也不行啊.
    这个问题是属于IE的BUG吗?
      

  3.   

    可能和ie的版本有关,我用的是winxp+ie6.0没有什么问题
      

  4.   

    例子:
    1.htm
    <form name=f>
    <input type="text" name=mxh>
    <input onclick="window.open('1.htm')" value="Test" type=button>
    </form>2.htm
    =============
    <body>
    <form>
    <input type="text" name=yuan>
    <input type="button" onclick="opener.document.f.mxh.value=this.form.yuan.value">
    </form>
      

  5.   

    请问 possible_Y(一切皆可能):
    出现这种错误是什么原因吗?
    请教.......
      

  6.   

    to: possible_Y(一切皆可能):
    opener我试过了,是可以的.
    但比如说,1.html里面有多个text,都要打开2.html,来对text进行赋值,这样的话,用opener就很难实现了2.html就不知道应该对哪个text赋值,所以我才想到用我的方法,但是有出现了我描述的问题.
    你有什么好的解决方案吗?
    增加一个hidden,来判断应该对哪个text赋值吗?
      

  7.   

    功能描述:
    点1.html的button ,打开2.html,在2.html文本框输入字符,点button,1.html相应
    的文本框出现相同的值.环境:
    1.html
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    function aa(){
        var w = window.open("2.html","aaa","");
      }</script>
    </head><body>
    <form>
    <input type=text name=a value="">
    <input type=button name=button1 value=button1 onclick="aa();">
    </form>
    </body>
    </html>
    ----------------
    2.html
    <HTML>
    <HEAD>
    <script>
     function onOK(){
                self.opener.forms[0].XXXX.value=document.forms[0].BBBB.value ;
                window.close()       }
    </script>
    </HEAD>
    <BODY onload="">
    <form>
    <input type=text name=a ><input type=button onclick="onOK()" value=button>
    <form>
    </BODY>
    </HTML>问题:(步骤)
    1.打开1.html,点button打开2.html.
    2.不关闭2.html,再点1.html上的button.进入到2.html.
    3.点2.html上的button,会出现top.x找不到的javascript错误.
    PS:如果没有出现这个问题,请重复做步骤2.3,会出现,但不是每次出现.
    如果你还没有出现的话,就把2.html放在一个frame里面,1.html去打开一个frame.
    这样会更容易出现.疑问:
    为什么?这个问题怎么解决???