JavaScript BOM moveBy and moveTo methods

<DOCTYPE html>
<html>
 <head>
  <title> JavaScript</title>
 </head>
 <body>
  <button onclick="openWindow()">Open Window</button>
  <button onclick="moveTo()">MoveTo</button>
  <button onclick="moveBy()">MoveBy</button>  
  <script>
   var myWindow;
   function openWindow()
   {
    myWindow=window.open("","","width=500px,height=200px,left=100px,top=100px");
    myWindow.document.write("<p>This is my window.</p>")
   }
   function moveTo()
   {
    myWindow.moveTo(200,200);
    myWindow.focus();
   }
   function moveBy()
   {
    myWindow.moveBy(200,200);
    myWindow.focus();
   }
  </script>
 </body>
</html>
 


OUTPUT




Comments