我用window.open弹出了一个窗口,现在的要求是在这个窗口中 点击  button,  更新数据库,之后这个窗口关闭,接着父窗口自动刷新
,怎么做

解决方案 »

  1.   

    button 获取点击click事件,
    执行数据库操作(可以用ajax),然后控制当前窗口关闭 ,然后控制父窗口刷新。
      

  2.   

    好吧
    page.html
    <html>
    <body>
    <script>
     function openw(){
      window.open("page1", "_blank", "height=600, width=800");
     }
    </script>
    <input type="button" onclick="openw()">
    </body>
    </html>
    page1.html
    <html>
    <body>
    <script>
    <input type="button">
    </body>
    </html>就这么简单,,先不考虑数据处理,就单击子窗口button,,关闭子窗口,刷新父窗口
      

  3.   

    page.html<html>
        <script>
         var ChildPage;
         function openw(){
            ChildPage = window.open("page1.html", "_blank", "height=600, width=800");
         }
         function refrashPage(){
             ChildPage.close();
             window.location = window.location;
         }
        </script>
        <body>
            <input type="button" onclick="openw()" value="弹出">
        </body>
    </html>
    page1.html
    <html>
        <body>
        <script>
            function closeAndfresh(){
               opener.refrashPage();
            }
        </script>
         <body> 
            <input type="button" onclick="closeAndfresh()" value="关闭并刷新">
        </body>
    </html>