如何控制弹出窗口的大小?

发布于 2024-12-10 12:12:06 字数 343 浏览 0 评论 0原文

我使用下面的js从原来的窗口弹出一个新窗口:

oWin = window.open("PServlet?module=LoginHandler","_blank",
"directories=no,location=no,menubar=no,resizable=yes,status=yes,titlebar=yes,toolbar=no", 
false);

正如你所看到的,我没有设置新窗口的大小或位置,但我的测试结果是每次弹出窗口的大小是从原始窗口的相同大小不规则地显示,有时是一半,有时是全屏或部分大小。

大家知道什么是道理吗? 如果我不改JS,如何才能让弹窗每次都全屏显示呢?

I used the following js to pop-up a new window from original window:

oWin = window.open("PServlet?module=LoginHandler","_blank",
"directories=no,location=no,menubar=no,resizable=yes,status=yes,titlebar=yes,toolbar=no", 
false);

As you can see, I did not set the size or location of new window, But my test results is that the size of pop-up windows on every time was shown irregularly from the same size of original window, sometimes it is half, sometime it is full screen or partial size.

Everybody know what is reason?
If I wouldn't change the JS, how can I let the pop-up window to be displayed in full screen in every times.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑梦风尘 2024-12-17 12:12:06

http://www.javascript-coder.com/window-popup /javascript-window-open.phtml

function mypopup()
{
    mywindow = window.open("http://www.javascript-coder.com", "mywindow", "location=1,status=1,scrollbars=1,  width=100,height=100");
    mywindow.moveTo(0, 0);
}

对于全屏,请参见此处:http://javascript-array.com/scripts/window_open/

function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

function mypopup()
{
    mywindow = window.open("http://www.javascript-coder.com", "mywindow", "location=1,status=1,scrollbars=1,  width=100,height=100");
    mywindow.moveTo(0, 0);
}

For fullscreen, see here: http://javascript-array.com/scripts/window_open/

function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文