Window moveTo() Method - Using moveBy() together with moveTo(): - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window moveTo

Description

Window moveTo() Method - Using moveBy() together with moveTo():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="openWin()">Create new window</button>
<button onclick="moveWinTo()">Move new window</button>
<button onclick="moveWinBy()">Move the new window by 75 * 50px</button>

<script>
var myWindow;/*from w ww . j  a  v a  2  s.c om*/

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

function moveWinTo() {
    myWindow.moveTo(150, 150);
    myWindow.focus();
}

function moveWinBy() {
    myWindow.moveBy(75, 50);
    myWindow.focus();
}
</script>

</body>
</html>

Related Tutorials