Definition and Usage..
The moveBy() method moves a window a specified number of pixels relative to its current coordinates.
Return Value: No return value
Syntax : window.moveBy(x, y)
Differents way how to declare moveBy() Method in program.
CODING:The moveBy() method moves a window a specified number of pixels relative to its current coordinates.
Return Value: No return value
Syntax : window.moveBy(x, y)
Differents way how to declare moveBy() Method in program.
<!DOCTYPE html>
<html>
<body>
<p>Open "NewWindow" and move the new window to the top left corner of the screen:</p>
<button onclick="openW()">New window</button>
<button onclick="moveTo()">Move window</button>
<script>
var newWindow;
function openW() {
newWindow = window.open("", "", "width=250, height=250");
newWindow.document.write("<p>This is newWindow click move button and move the newWindow.</p>");
newWindow.moveBy(50, 50);
}
function moveTo() {
newWindow.moveBy(50, 50);
newWindow.focus();
}
</script>
</body>
</html>
<html>
<body>
<p>Open "NewWindow" and move the new window to the top left corner of the screen:</p>
<button onclick="openW()">New window</button>
<button onclick="moveTo()">Move window</button>
<script>
var newWindow;
function openW() {
newWindow = window.open("", "", "width=250, height=250");
newWindow.document.write("<p>This is newWindow click move button and move the newWindow.</p>");
newWindow.moveBy(50, 50);
}
function moveTo() {
newWindow.moveBy(50, 50);
newWindow.focus();
}
</script>
</body>
</html>
Comments
Post a Comment