window.open在IE& FF中打开不同的大小

时间:2014-11-14 13:47:12

标签: javascript size window.open

代码:

win3 = window.open("Pages/Login.php", "newwindow", "width=316, height=468");
win3.moveTo(screen.width / 2 - 300, screen.height / 2 - 250);

结果:

enter image description here

为什么有不同的尺寸?

2 个答案:

答案 0 :(得分:0)

来自MDN的strWindowFeaturesThe string must not contain any whitespace, and each feature name and its value must be separated by a comma

所以,

win3 = window.open("Pages/Login.php", "newwindow", "width=316,height=468");
win3.moveTo(screen.width / 2 - 300, screen.height / 2 - 250);

应该没事吗?

答案 1 :(得分:0)

我用resizeTo()函数修复它。

win3 = window.open("Pages/Login.php", "newwindow", "width=316, height=468");
win3.resizeTo(316, 468);
win3.moveTo(screen.width / 2 - 300, screen.height / 2 - 250);

Ty求助!