希望得到这么一个效果:
从父窗口弹出一子窗口用来显示可供选择的信息,在选择了子窗口信息提交后关闭子窗口并将所选信息返回给父窗口显示出来。

解决方案 »

  1.   


    请问有AJAX推荐学习资料吗?
      

  2.   

    ajax
    其實基本的js也能實現
      

  3.   

    product.php
    <a href='Javascript: SelectProduct(1);' class='blue'>function SelectProduct(SelectRow)
    {
    var sRowId=document.all.rowId.value;
    window.opener.document.getElementById("productID"+sRowId).value
    =window.document.getElementById("productID"+SelectRow).value; 
    window.opener.document.getElementById("ItemCode"+sRowId).value
    =window.document.getElementById("TypeName"+SelectRow).value; 
    window.opener.document.getElementById("ProductCode"+sRowId).value
    =window.document.getElementById("ProductCode"+SelectRow).value; 
    window.opener.document.getElementById("Description"+sRowId).value
    =window.document.getElementById("BrandName"+SelectRow).value
    +"  "+window.document.getElementById("TypeName"+SelectRow).value
    +"  "+window.document.getElementById("ModelNo"+SelectRow).value
    +"  "+window.document.getElementById("ProductCode"+SelectRow).value;; 
    window.opener.document.getElementById("UnitPrice"+sRowId).value
    =window.document.getElementById("NewPrice"+SelectRow).value; 
    //window.close();
    window.location.href="productvendorlist.php?rowId="+sRowId+"&productID="
    +window.document.getElementById("productID"+SelectRow).value;
    }
    productvendorlist.php<td valign='center' align='center'><A Href='Javascript: SelectVendor("11"); '>Select</td>function SelectVendor(SelectRow)
    {
    var sRowId=document.all.rowId.value;
    window.opener.document.getElementById("cost"+sRowId).value
    =window.document.getElementById("NewCost"+SelectRow).value; 
    window.close();
    }
      

  4.   

    用两个页面做:
    fathe.php
    <?php
    echo $_GET['tex'];
    ?>
    <script type="text/javascript"> window.open("son.html","name","height=300,width=400");
    </script>son.html
    <html>
    <head>
    <title>子窗口</title>
    <script type="text/javascript">
    function f1_submit(){ window.close("name");
    }
    </script>
    </head><body>
    <form name="f1" action="test.php">
     <input name="tex" type="text">
     <input type="button" value="提 交" onClick="f1_submit()">
    </form>
    </body>
    </html>
      

  5.   

    不好意思前段时间有事。
    我用你的方法还是不行啊,form的方法用POST或get都不行。
    php.ini也改了register_globals = On
      

  6.   

    用JS parent不就好了?
    onclick="set();"
    function set()
    {
      window.close();
      parent.document.getElementById('fsdfads').value='';
    }
      

  7.   

    看六楼兄弟的回复
    window.opener.document.getElementById("productID"+sRowId).value
             |
           父窗体的
    = window.document.getElementById("productID"+SelectRow).value; 
              |
           子窗体的作用就是将子窗体上的某一控件的值赋给父窗体上的某一控件
    这段代码是写在子窗体中的
      

  8.   

    onclick="set();" 
    function set() 

      window.close(); 
      parent.document.getElementById('fsdfads').value=''; 
    }
    还是这个简单明了
      

  9.   

    //test2.html
    <div id='test' style='width:200px;height:200px;border:1px solid red;'></div>
    <input type='button' onclick='window.open("test3.html");' value='open'>
    //test3.html
    <script language='javascript'>
     function save()
     {
      var tmp = document.getElementById("ttt");
      window.opener.document.getElementById("test").innerHTML = tmp.value;
      window.close();
     }
    </script>
    <input type='text' id='ttt' value='' name='ttt'/>
    <input type='button' onclick='save();' value='save'>