window.moveBy() : Window Object : Window JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Window » Window Object »

 

window.moveBy()











Syntax








window.moveBy(numHort, numVert)



The moveBy() method moves the window by the number of pixels.

The first numeric value represents the vertical pixels, while the second numeric value represents the horizontal number of pixels.

If the numbers passed are positive, the window is moved to the right horizontally, and up vertically. Negative numbers move the window in the opposite direction.












<html>
    <script language="JavaScript1.2">
    <!--
    function moveWin(dir, dist){
      var myVert;
      var myHorz;

      if(dir == "vert"){
        myHorz = 0;
        myVert = dist;
      }else{
        myHorz = dist;
        myVert = 0;
      }
      window.moveBy(myHorz, myVert);
    }
    -->
    </script>
    <body>
    <form>
    <table border=0>
      <tr>
        <td><input type=BUTTON value="  Up  " onClick="moveWin('vert',-1)"></td>
      </tr>
      <tr>
        <td><input type=BUTTON value=" Left " onClick="moveWin('horz',-1)"></td>
        <td><input type=BUTTON value="Right" onClick="moveWin('horz',1)"></td>
      </tr>
      <tr>
        <td><input type=BUTTON value="Down" onClick="moveWin('vert',1)"></td>
      </tr>
    </table>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Window
» Window Object