javascript 如何设置弹出窗口大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4343965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 11:06:35  来源:igfitidea点击:

How to set PopUp Window size

javascriptasp.netpopup

提问by Dr. Rajesh Rolen

I have opend a popup window using javascript. now in that popup window i have got a button and on click on that button i wants to changes size of that (current/same page) popup window.

我已经使用 javascript 打开了一个弹出窗口。现在在那个弹出窗口中我有一个按钮,点击那个按钮我想改变那个(当前/同一页面)弹出窗口的大小。

Please tell me how we can do this. Thanks

请告诉我我们如何做到这一点。谢谢

采纳答案by Damien-Wright

IE:

IE:

self.resizeTo(500,400);

Other browsers:

其它浏览器:

window.outerHeight = 500;
window.outerWidth = 400; 

Those examples were from the site mentioned below:

这些例子来自下面提到的网站:

http://www.perlscriptsjavascripts.com/tutorials/javascript/window_1.html

http://www.perlscriptsjavascripts.com/tutorials/javascript/window_1.html

Hope that helps :)

希望有帮助:)

回答by Dr.Molle

The methods you have to use are resizeTo()or resizeBy().

您必须使用的方法是 resizeTo()resizeBy()

The option to resize a window may be restricted by browser-settings.

调整窗口大小的选项可能会受到浏览器设置的限制。