简体   繁体   English

JavaScript:window.open() 函数在新窗口中打开链接,而不是在 IE7 中证明相同的窗口名称

[英]JavaScript : window.open() function opening link in new window instead of proving same window name in IE7

I have two buttons (A & B) on a page which opens a new window on click.我在一个页面上有两个按钮(A 和 B),点击后会打开一个新窗口。 Both the buttons are using same JavaScript function and the windowName is passed dynamically ( _AWindow is passed for button A and _BWindow is passed for button B).两个按钮都使用相同的 JavaScript 函数,并且 windowName 是动态传递的( _AWindow传递给按钮 A, _BWindow传递给按钮 B)。

JavaScript code to open window is:打开窗口的 JavaScript 代码是:

window.open(s_url,windowName); 

I am facing following strange problem.我正面临以下奇怪的问题。

If I click on button A first time then it opens link( https://www .) in a new window(name : _AWindow) and again clicking the same button opens the link in existing window.如果我第一次单击按钮 A,那么它会在新窗口(名称:_AWindow)中打开链接( https://www .),然后再次单击同一按钮在现有窗口中打开链接。

BUT

If I click on button B first time then it opens link( https://secure . ) in a new window (name : _BWindow) but again clicking the button B it again opens a new window instead of opening link in same window.如果我第一次单击按钮 B,那么它会在新窗口(名称:_BWindow)中打开链接( https://secure . ),但再次单击按钮 B 它会再次打开一个新窗口,而不是在同一窗口中打开链接。

I am using IE7 version 7.0.5730.13我使用的是 IE7 版本 7.0.5730.13

Please help!请帮忙!

Do you have a global variable with the name "name" in the page opening in _BWindow ?_BWindow打开的页面中是否有名为“name”的全局变量? Changing the value of the global would rename the window, causing the second launch to fail.更改全局值会重命名窗口,导致第二次启动失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM