将新窗口移动到指定的位置

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. var myWindow;
  6. function openWin() {
  7. myWindow=window.open("", "", "width=400, height=200");
  8. }
  9.  
  10. function moveWin() {
  11. myWindow.moveTo(300, 0);
  12. myWindow.focus();
  13. }
  14. </script>
  15. </head>
  16. <body>
  17.  
  18. <input type="button" value="打开 myWindow" onclick="openWin()" />
  19. <br><br>
  20. <input type="button" value="移动 myWindow" onclick="moveWin()" />
  21.  
  22. </body>
  23. </html>