Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Open New Window Example</title> </head> <body> <button onclick="openNewWindow()">Click to Open a New Window</button> <script> function openNewWindow() { // Open a new window and specify its properties var myWindow = window.open("", "MsgWindow", "width=400,height=200"); myWindow.document.write("<p>Welcome to a new pop-up window! This is created using JavaScript.</p>"); } </script> </body> </html>