当子窗口关闭时刷新父母的一部分

时间:2015-05-28 10:59:18

标签: javascript php jquery window

第1页:tabeloverzicht.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tabel overzicht</title>
<link href="../css/templatemo_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../css/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function() {
    $(document).ready(function() {      
        $.get(
        'tabel.php', 
        function(response){
            $('#tabelplaats').html(response);
        }
    );
    });

    $(window).click(function(event){
        $.get(
        'tabel1.php',
        function(response){
            $('#tabelplaats').html(response);
        }
    );
}); 
});
</script>
</head>

<body>
<div id="tabelplaats">

</div>
</body>
</html>

第2页:tabel.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/templatemo_style.css" rel="stylesheet" type="text/css" />
<title>Tabel Processor</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "',  'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,h eight=500,left = 200,top = 200');");
}
// End -->
</script>
</head>

<body>

<table>
<tr>
    <th>Hallo</th>
    <th>dit</th>
    <th>is</th>
</tr>
<tr>
    <td>een</td>
    <td>test</td>
    <td><a HREF="javascript:popUp('popup.php')"><div id="modify" class="buttonsmall"><button id="BedrijfAanpassen" class="button" name="modify"><i class="icon-pencil icon-small"></i></button></div></a></td>
</tr>
</table>

</body>
</html>

第3页:Tabel1.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/templatemo_style.css" rel="stylesheet" type="text/css" />
<title>Tabel Processor</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=500,left = 200,top = 200');");
}
// End -->
</script>
</head>

<body>

<table>
<tr>
    <th>Test</th>
    <th>test</th>
    <th>test</th>
</tr>
<tr>
    <td>test</td>
    <td>test</td>
    <td>test</td>
</tr>
</table>

</body>
</html>

Page4:popup.php

这页上的内容无关紧要。

Tabeloverzicht是主页。这是一个显示的表格。该表包含一个打开弹出窗口的按钮(在我的应用程序中,您可以在弹出窗口中更改表的某些值)当弹出窗口关闭时,他需要更新父窗口中的表。 window.opener.reload(true)对我不起作用,因为主页面上还有许多其他选项可以重置。我只需要更新顶部表格。

此外,在我的应用程序中将有第二个表,根据打开的弹出窗口,他需要刷新第一个或第二个表。

希望任何人都可以提供帮助,因为我已经坚持了几天这个问题......

提前致谢!

1 个答案:

答案 0 :(得分:0)

在我看来,你需要在主页面和内部有一个回调函数,你可以做任何事......

例如: 的index.html

error.log

pop.html

<html>
    <head>
        <SCRIPT LANGUAGE="JavaScript">
            <!-- Begin
            function popUp(URL) {
                day = new Date();
                id = day.getTime();
                eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=500,left = 200,top = 200');");
            }
        // End -->
            function callback_top(){
                console.log("callback_top()");
            }

        </script>
    </head>
    <body>
        <button onclick="popUp('pop.html');">Press me</button>
    </body>
</html>