Move a window in Javascript

Description

moveBy() moves a windows.

Example

The following code moves a windows by 100 pixels.


<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
    </head> 
    <body> 
        <script type="text/javascript"> 
            <!--  ww w .  j a v  a  2 s  . c o  m-->
            //move the window down by 100 pixels 
            window.moveBy(0, 100); 

        </script> 
    </body> 
</html>

Click to view the demo

Example 2

The following code moves window to the left.


<!DOCTYPE HTML> 
<html> 
    <body> 
        <script type="text/javascript"> 
            <!--from w  w  w .  ja  v a 2 s .  c  o  m-->
            //move the window left by 50 pixels 
            window.moveBy(-50, 0); 

        </script> 
    </body> 
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window