Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个父窗口,让 saz M,在单击 M 中的按钮时,会打开一个弹出窗口。当在弹出窗口中选择某个选项并单击“确定”按钮时,弹出窗口应关闭并在主窗口中显示一条消息。这可以通过javascript实现吗?
是的,这是可能的。
关闭弹出窗口window.close()
window.close()
与父窗口通信window.opener.postMessage()(window.opener是父窗口对象,您甚至可以在其中调用直接命名的函数,例如window.opener.funcName())
window.opener.postMessage()
window.opener
window.opener.funcName()
下次请在您要求之前寻找现有的解决方案,有很多这样的。
祝你好运