简体   繁体   English

如何从子 window 调用父 window 上的事件

[英]How do I invoke an event on a Parent window from a Child window

I have a Parent window that displays information, including a link to open a Child window to edit the same information.我有一个父 window 显示信息,包括打开子 window 以编辑相同信息的链接。 I want to be able to either refresh the Parent window or activate a button on the Parent to re-select the data, when the Child window is being closed.当子 window 正在关闭时,我希望能够刷新父 window 或激活父上的按钮以重新选择数据。 Both programs are written in PHP.这两个程序都是用 PHP 编写的。

The Parent program opens the Child window using the following JavaScript function:父程序使用以下 JavaScript function 打开子 window:

function windowOpen(loadURL) {
      // In order to allow JavaScript to Close the Window, the Windows needs to be
      //  opened with JavaScript.  The URL to be loaded into the new Window is passed
      //  as a parameter.
    window.open(loadURL, "_blank");
}

The Child program currently uses this JavaScript function to close itself: Child程序目前使用这个JavaScript function来关闭自己:

function windowClose() {
    window.open('','_parent','');
    window.close();
}

How do I change the windowClose() function to either: i) Refresh the Parent window;如何将 windowClose() function 更改为: i) 刷新父 window; or ii) click a button on the Parent page that will re-select and re-display the page.或 ii) 单击父页面上的按钮,该按钮将重新选择并重新显示该页面。

Thank you in advance.先感谢您。

It's not clear what you are trying to achieve but try cross window communication目前尚不清楚您要实现什么,但尝试跨 window 通信

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM