English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
moveTo()moves the current window to the specified coordinates.
This method moves the window to an absolute position. In contrast,window.moveBy()Move the window relative to its current position.
window.moveTo(x, y)
// Function to open a new window function windowOpen() { popupWindow = window.open("", "", "width=")200, height=200"); } // Function to move the opened window function windowMove() { popupWindow.moveTo(200, 200); popupWindow.focus(); }Test and See‹/›
All browsers fully support the moveTo() method:
Method | |||||
moveTo() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
x | The horizontal coordinate to move to |
y | The vertical coordinate to move to |
Return Value: | None |
---|
This example combines moveBy() with moveTo():
function windowMoveTo() { popupWindow.moveTo(150, 150); popupWindow.focus(); } function windowMoveBy() { popupWindow.moveBy(100, 100); popupWindow.focus(); }Test and See‹/›
Window (Window) Reference:moveBy() method
Window (Window) Reference:resizeBy() method
Window (Window) Reference:resizeTo() method