create a webpage in new windows



Write a javascript code to create a webpage in new window.



<html>            
  <head>
    <script>
    
    function openWindows() 
    {
        var new_win = window.open("", "New Window", "width=300,height=300");

        new_win.document.write("<html>");
        new_win.document.write("<head>");
        new_win.document.write("<title>New Window</title>");
        new_win.document.write("</head>");
        new_win.document.write("<body>");
        new_win.document.write("<h3><p>Welcome to the New Window.</p></h3>");
        new_win.document.write("<h4><p>This Webpage is created in New Window.</p></h4>");
        new_win.document.write("</body>");
        new_win.document.write("</html>");

        new_win.document.close(); 
    }

    </script>
  </head>
<body>
    
    <p>Click to open a new window.</p>
    <input type="button" onclick="openWindows()" value="Open New Window">

  </body>
</html>

Output: