相对于当前位置移动新窗口
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- var myWindow;
- function openWin() {
- myWindow=window.open("", "", "width=400, height=200");
- }
- function moveWin() {
- myWindow.moveBy(250, 250)
- }
- </script>
- </head>
- <body>
- <input type="button" value="打开 myWindow" onclick="openWin()" />
- <br><br>
- <input type="button" value="移动 myWindow" onclick="moveWin()" />
- </body>
- </html>