close a new window



Write a javascript code to close a window.


<html>            
  <head>
    <script>
    
        function openWindow()
        {
            new_win = window.open("","","width=200,height=100");   
        }

        function closewindow()
        {
            new_win.close();
        }

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

    <p> Click to Close a new window  </p>
    <input type="button" value="Close new window" onclick="closewindow()"/>

  </body>
</html>

Output: