运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The moveBy() Method</h2> <p>Open "myWindow" and move the new window 250px relative to its current position:</p> <button onclick="openWin()">Open "myWindow"</button> <button onclick="moveWin()">Move "myWindow"</button> <script> let myWindow; function openWin() { myWindow = window.open("", "", "width=400, height=400"); } function moveWin() { myWindow.moveBy(250, 250); } </script> </body> </html>