How to use Window Object MoveTo in JavaScript

In this article I am going to explain about window object MoveTo() Method in JavaScript.
  • 2127

JavaScript Window Object MoveTo() Method

JavaScript MoveTo() Method is also use for moving window but main purpose of this method is to move window on specifics position.

Syntax

 

Window.MoveTo(X,Y)

Example

In this example when you will click on open win button then a new window will be open and when you will click on move win then window will be set on defined psition.

<html>

<head>

    <script type="text/javascript">

        function Winopen() {

            Win = window.open('', '', 'width=300,height=75');

            Win.document.write("<h5>click move to move window");

        }

 

        function Winmove() {

            Win.moveTo(10, 10);

            Win.focus();

        }

    </script>

</head>

<body>

    <button onclick="Winopen()">

        Win open</button>

    <button onclick="Winmove()">

        Win Move</button>

</body>

</html>

 

Output


winmove.gif

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.