Javascript:关闭弹出窗口
我在主页上有一个按钮,它将打开 (window.open()) 窗口 W1 以允许用户在其上选择内容。之后,用户按 W1 上的 OK 按钮打开窗口 W2(再次 window.open())。用户按确定后如何关闭W1?
I have a button on the main page, which will open (window.open()) a window W1 to allow user to select stuff on it. After that, user press OK button on the W1 to open window W2 (again window.open()). How can i close the W1 after the user press OK?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用带有目标窗口名称的
window.close()
方法,如下所示:Use the
window.close()
method with the name of the target window as shown below:在主页上,您将弹出窗口保存到 W1 中,并定义一个将关闭 W1 的函数:
现在在 W1 上打开 W2 的同一位置:
就是这样。你完成了。
On the main page you save popup into W1 and define a function that will close W1:
Now on W1 in the same place where you open W2:
That's it. You're done.