关闭后带有回传参数的Javascript窗口

时间:2023-01-20 17:04:16

How can I pass back some arguments from a window that is closed?

如何从关闭的窗口中传回一些参数?

For example Insert file dialog in TinyMCE does this. When file is selected the url is pasted into editor. (The url is passed back to the main window)

例如,TinyMCE中的插入文件对话框就是这样做的。选择文件后,URL将被粘贴到编辑器中。 (网址传回主窗口)

I am using Prototype fyi, if that helps.

我正在使用Prototype fyi,如果这有帮助的话。

PS: I rephrased this question to better describe my requirements here.

PS:我改述了这个问题,以便更好地描述我的要求。

1 个解决方案

#1


Use window.open('myPage.htm') to launch your popup.

使用window.open('myPage.htm')启动弹出窗口。

Then within myPage.htm you can use opener to reference the parent window before closing...

然后在myPage.htm中你可以使用opener在关闭之前引用父窗口...

opener.document.getElementById('yourDiv').innerHTML = 'Look at me!';
self.close();

#1


Use window.open('myPage.htm') to launch your popup.

使用window.open('myPage.htm')启动弹出窗口。

Then within myPage.htm you can use opener to reference the parent window before closing...

然后在myPage.htm中你可以使用opener在关闭之前引用父窗口...

opener.document.getElementById('yourDiv').innerHTML = 'Look at me!';
self.close();