运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The moveTo() Method</h2> <p>Open "myWindow" and move it to the position 500 x 100:</p> <button onclick="openWin()">Open "myWindow"</button> <button onclick="moveWin()">Move "myWindow"</button> <script> let myWindow; function openWin() { myWindow=window.open("", "", "width=400, height=200"); } function moveWin() { myWindow.moveTo(500, 100); } </script> </body> </html>