<!DOCTYPE html> <html> <body> <h1>Window 对象</h1> <h2>moveBy() 方法</h2> <p>打开 "myWindow" 并将新窗口相对于当前位置移动 250px:</p> <button onclick="openWin()">打开 "myWindow"</button> <button onclick="moveWin()">移动 "myWindow"</button> <script> let myWindow; function openWin() { myWindow = window.open("", "", "width=400, height=400"); } function moveWin() { myWindow.moveBy(250, 250); } </script> </body> </html>