1.htm 父窗口<html>
   <body>
      <script>
var i;
function o()
{
  var op = window.open("2.htm","op","",true);
}
      </script>
      <input type="button" value="Botton" onclick="javascript:alert(i)"/>
      <input type="button" value="open 2.htm" onclick="o()">
   </body>
</html>2.htm 子窗口<html>
  <body>
    <form id="myform">
    <input type="Text" ib="t"/>
    <input type="button" onclick="js();"/>
    <script>
       js()
       {
 window.opener.i = myform.t.value;
         
       }
    </script>
    </form>  
</body>
</html>以上就是出问题了的代码,要改变的变量是i。
请各位指出问题所在且怎么改。

解决方案 »

  1.   

    var a=window.opener.document.getelemengtbyid("id");
    a.value='XXX";
    好象对着呢呀.
      

  2.   

    2.htm, 那个是id不是ib ,还有 js函数前面少了个 function
    <html>
      <body>
        <form id="myform">
        <input type="Text" id="t"/>
        <input type="button" onclick="js();"/>
        <script>
          function js()
           {
         window.opener.i = myform.t.value;
                
           }
        </script>
        </form>  
    </body>
    </html>