关闭弹出窗口并刷新父页面


Close the popup and refresh the parent page

home.php

<a href='javascript:void(0);' onclick="pepz('<?php echo"ppc-mngt_transfer.php?id=$i->sm_id"; ?>', 'myPop1',400,400)"><?php print"$i->sm_jo<br>$i->sm_custo_name"; ?></a>

ppc-mngt_transfer.php

  <script type="text/javascript">
        function refreshAndClose() {
            window.close();
            window.opener.location.reload(true);
        }
    </script>
    <body onbeforeunload="refreshAndClose();">
    <form name='mainform' method='post' action='do.php?ppc/workload'>
    <?php
    print "<h1>COPY TO WORKLOAD</h1>";
    print "<table class='clean_form'>";
    print "<tr><td>J.O. Number</td><td><input name='ppc_jo' value='$i->sm_jo' style='width:250'></td></tr>";
    print "<tr><td>Customer Name</td><td><input name='ppc_custo_name' value='$i->sm_custo_name' style='width:250'></td></tr>";
    print "<tr><td>Description</td><td><input name='ppc_subject' value='$i->sm_subject' style='width:250'></td></tr>";
    print "<tr><td>Date Start</td><td><input name='ppc_dpdate' value='$i->sm_dpdate' style='width:250'></td></tr>";
    print "<tr><td>Duration</td><td><input name='ppc_proj_duration' value='$i->sm_proj_duration' style='width:250'></td></tr>";
    print "<input type='hidden' name='ppc_m_id' value='$id'>";
    print "</table>";
    print "<tr><input type='checkbox' name='ppc_mark' value='ok' checked/></tr>";
    ?>
    <input type="submit" value="submit">
    </form>
    </body>

我想我的代码是这样做的>刷新然后关闭。。。。我需要的是点击弹出窗口中的提交按钮后关闭,然后刷新父页面。请帮帮我,我的Javascript知识很差。

<form name='mainform' method='post' action='do.php?ppc/workload' onsubmit="refreshAndClose();">

function refreshAndClose() {
            window.opener.location.reload(true);
            window.close();
}

只要确保表格真的提交了,如果没有,我们需要稍微调整一下。

我实际上会在do.php文件中添加window.close()。因此,如果出现提交错误,您也可以处理这些错误。