用 JavaScript 打开一个全新的窗口,而不替换前一个窗口的内容
我有一个包含多个链接的页面,这些链接打开一个包含不同内容的单独窗口。我的目标是使用 JavaScript 为每个此类链接打开一个窗口。我的问题如下:
让我们假设: - 我的页面上有两个链接,lnkDoWorkOne 和 lnkDoWorkTwo - lnkDoWorkOne 打开一个 url = WorkOne.aspx 的窗口,该窗口又在加载时执行一些工作 - lnkDoWorkTwo 打开一个 url = WorkTwo.aspx 的窗口,它也做了一些工作
在我目前的解决方案中,当我单击 lnkDoWorkOne 时,会打开一个包含 WorkOne.aspx 的新窗口,并且工作得很好。然后,当我单击 lnkDoWorkTwo 时,根本没有新窗口,但之前打开的窗口的内容只是被 WorkTwo.aspx 替换。我需要使用 WorkOne.aspx 和 WorkTwo.aspx 打开两个窗口,以便用户可以并行查看内容。
有谁知道如何实现这一目标?
I have a page with several links that open a separate window with varying content. My goal is to open a window for each and every such link using JavaScript. My problem is as follows:
let's assume:
- i have two links on the page, lnkDoWorkOne and lnkDoWorkTwo
- lnkDoWorkOne opens a window with url = WorkOne.aspx which in turn does some work upon loading
- lnkDoWorkTwo opens a window with url = WorkTwo.aspx which also does some work
In my present solution when I click lnkDoWorkOne then a new window opens with WorkOne.aspx and works just fine. Then when I click lnkDoWorkTwo, then there's no new window at all but the contents of the previously opened window are simply replaced by WorkTwo.aspx. I need to have BOTH windows open with WorkOne.aspx and WorkTwo.aspx so that the user can view the contents in parallel.
Does anyone know how to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否为两个
window.open
调用指定了相同的窗口名称?如果是这样,请更改窗口的名称,您应该会得到两个单独的窗口。Are you giving the same window name to the both
window.open
calls? If so, change the name of the window and you should get two separate windows.window.open(url, 'related_url');
window.open(url , 'related_url');