开发者

How to open new browser window for popup?

Following Javscript can open popup:

window.open('http://www.google.com','mywindow','width=400,height=200');

If call it two times like:

window.open('http://www.google.com','mywindow1','width=400,height=200');
window.open('http://www.google.com','mywindow2','width=400,height=200');

The later will override previous only one popup. I want to two separated windows for popup at sametime with above code. even I set different reference name like mywi开发者_StackOverflowndow1, mywindow2.

How to fix this problem?

More info:

The way I call js in code-behind is:

string js = "<script language=javascript> window.open("myurl1","_blank","DialogWidth=700;DialogHeight=750;left=30;top=30;");</script>";
Response.Write(sUrl);

js = "<script language=javascript> window.open("myurl2","_blank","DialogWidth=700;DialogHeight=750;left=30;top=30;");</script>";
Response.Write(sUrl);

It looks like later close the previous window.


window.open('http://www.google.com','_blank','width=400,height=200');
window.open('http://www.google.com','_blank','width=400,height=200');

See MSDN documentation.


It shouldn't, you should get a new window because the window names are different ("mywindow1" vs. "mywindow2"). Do you really need to name the windows? If not, try "_blank" instead. If you're not putting the digits on the end, that's your problem — using the same window name reuses the window (by design).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜