English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
resizeTo()The method adjusts the window size to the specified width and height.
window.resizeTo(width, height)
// Function to open a new window function windowOpen() { popupWindow = window.open("", "", "width=",150, height=150"); } // Adjust the function of opening window size function windowResize() { popupWindow.resizeTo(500, 500); popupWindow.focus(); }Test and See‹/›
All browsers fully support the resizeTo() method:
Method | |||||
resizeTo() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
width | Set the width of the window (in pixels) |
height | Set the height of the window in pixels |
Return Value: | None |
---|
This example combines resizeBy() with resizeTo():
function windowResizeTo() { popupWindow.resizeTo(500, 500); popupWindow.focus(); } function windowResizeBy() { popupWindow.resizeBy(100, 100); popupWindow.focus(); }Test and See‹/›
Window (Window) Reference:resizeBy() Method
Window (Window) Reference:moveTo() Method
Window (Window) Reference:moveBy() Method