如何将数据从弹出窗口传递到父窗口?

2022-01-20 00:00:00 popup jquery javascript

如何从弹出窗口传递一些数据或调用父窗口上的函数?

How can I pass some data or call a function on the parent window from a popup window?

用户将单击一个链接,该链接将在同一网站上打开一个弹出窗口,一旦他完成弹出窗口,我希望它将新数据发送回父窗口,或调用父窗口上的函数.

The user will click a link which will open a popup on the same website, once he is finished with the popup, I want it to send the new data back to the parent window, or call a function on the parent window.

推荐答案

window.opener 对象是您要查找的对象,在弹出窗口中使用它来调用父窗口的 a 函数:

The window.opener object is what you're looking for, used it from within your popup like so to call the a function of the parent window:

window.opener.yourFunc() 

相关文章