窗口.与参数一起使用时,Open不打开新窗口

window.open is not opening a new window when used with parameters

本文关键字:窗口 新窗口 参数 一起 Open      更新时间:2023-09-26

当点击超链接时,我调用下面的函数

window.open("<%=forHyperLink%>",'name','height=600,width=800');

问题是,与上面的行,只有一次超链接点击是工作的(也就是说,如果另一个超链接被点击,没有窗口被打开)

但是如果我删除window的参数。打开并使用

window.open("<%=forHyperLink%>");

然后点击每个超链接一个新的窗口被打开。

请指教。

更改每个链接的每个窗口的name,以便在初始点击时打开的窗口不会被重复使用。

我猜点击其他链接会打开初始/当前打开的弹出窗口上的链接,并造成混淆,因为它不会打开新窗口。

// first window to open
window.open("first.html",'name','height=600,width=800');
// opens in the same window where first.html is opened because 
// it targets the same window called `name`
window.open("second.html",'name','height=600,width=800');
// this works because by default it will open a new one everytime it is executed
window.open("new.html");
// opens a window with unique name 
window.open("<%=forHyperLink%>",'name_' + Math.random(),'height=600,width=800');

您可以使用window.open("<%=forHyperLink%>",'name_'+(new Date()).getTime(),'height=600,width=800');

'name_'+(new Date()).getTime()将在每次打开窗口时更改

oNewWindow = window。open([sURL] [, sName] [, sFeatures] [, bReplace])

请查看窗口的详细信息。从以下链接打开

http://msdn.microsoft.com/en-us/library/ms536651 (v = vs.85) . aspx