下面的JS代码演示了如何通过window.open弹出一个新的窗口,然后动态修改窗口大小
<!DOCTYPE html> <html> <head> <script> var w; function openwindow() { w=window.open('','', 'width=100,height=100'); w.focus(); } function myFunction() { w.resizeTo(500,500); w.focus(); } </script> </head> <body> <button onclick="openwindow()">Create window</button> <button onclick="myFunction()">Resize window</button> </body> </html>