<!DOCTYPE html> < html > < body style="display: flex; flex-direction: column; justify-content:center; align-items:center;"> < div class = "container" style="position: relative; text-align: center;"> < h1 style = "color: rgb(18, 154, 18);" > GeeksforGeeks </ h1 > < h3 > window open and close method</ h3 > < button onclick = "windowOpen()" > Open GeeksforGeeks </ button > < button onclick = "windowClose()" > Close GeeksforGeeks </ button > </ div > < script > let Window; // Function that open the new Window function windowOpen() { Window = window.open( "_blank", "width=400, height=300, top=230, left=540"); } // function that Closes the open Window function windowClose() { Window.close(); } </ script > </ body > </ html > |