Window resizeTo() Method - Using the resizeTo() method together with resizeBy(): - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window resizeTo

Description

Window resizeTo() Method - Using the resizeTo() method together with resizeBy():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="openWin()">Create window</button>
<button onclick="resizeWinTo()">Resize the window to 800px * 600px</button>
<button onclick="resizeWinBy()">Make the new window smaller</button>

<script>
var myWindow;/*from  w  w  w . j a v  a2 s.c o  m*/

function openWin() {
    myWindow = window.open("", "", "width=250, height=250");
}

function resizeWinTo() {
    myWindow.resizeTo(800, 600);
    myWindow.focus();
}

function resizeWinBy() {
    myWindow.resizeBy(-100, -50);
    myWindow.focus();
}
</script>

</body>
</html>

Related Tutorials