The example in this article describes how to use JavaScript to pop up a new window and control the window to move to a specified position. Share it with everyone for your reference. The details are as follows:
The following JS code pops up a new window through window.open, and then controls the window to move to the specified position through the JS code
<!DOCTYPE html> <html> <head> <script> function openWin() { myWindow=window.open('','','width=200,height=100'); myWindow.document.write("<p>This is 'myWindow'</p>"); } function moveWin() { myWindow.moveTo(0,0); myWindow.focus(); } </script> </head> <body> <input type="button" value="Open 'myWindow'" onclick="openWin()" /> <br><br> <input type="button" value="Move 'myWindow'" onclick="moveWin()" /> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.