Javascript examples for Browser Object Model:Window resizeTo
The resizeTo() method resizes a window to the specified width and height.
Parameter | Type | Description |
---|---|---|
width | Number | Required. Sets the width of the window, in pixels |
height | Number | Required. Sets the height of the window, in pixels |
No return value
The following code shows how to Open a new window, and set its width and height to 250px:
<!DOCTYPE html> <html> <body> <button onclick="openWin()">Create window</button> <button onclick="resizeWin()">Resize window</button> <script> var myWindow;//from w w w .j a va 2 s .c o m function openWin() { myWindow = window.open("", "", "width=100, height=100"); } function resizeWin() { myWindow.resizeTo(250, 250); myWindow.focus(); } </script> </body> </html>