The moveTo() method

The moveTo() method moves the window to a particular location on the screen based on the given coordinates.

window.moveTo(x-value,y-value);

Let’s take the previous example and replace moveBy() with moveTo().

<body>
<h1>I am an amazing new window<br>
I have been opened with JavaScript.</h1>
<form>
<input type="button" value="Move Window" onclick="window.moveTo(50,50);" />
<input type="button" value="Close Window" onclick="window.close();" />
</form>
</body>

Leave a Reply