Home > Article > Web Front-end > How to output content to the parent window after JavaScript pops up a new window_javascript skills
The example in this article describes the method of outputting content to the parent window after JavaScript pops up a new window. Share it with everyone for your reference. The details are as follows:
The following JS code demonstrates how to open a pop-up window through the window.open method, and then output information to the parent window through the handle of the pop-up window
<!DOCTYPE html> <html> <head> <script> function openWin() { myWindow=window.open('','','width=200,height=100'); myWindow.document.write("<p>This is 'myWindow'</p>"); myWindow.focus(); myWindow.opener.document.write("<p>This is the source window!</p>"); } </script> </head> <body> <input type="button" value="Open 'myWindow'" onclick="openWin()" /> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.