<!DOCTYPE html>
<html lang="en-US">
<body>
<button onclick="myOpen()">Open Window</button>
<button onclick="myClose()">Close Window</button>
<button onclick="myFunction()">Check Status</button>
<p id="point"></p>
<script>
var myWindow;
var x = document.getElementById("point");
function myOpen(){
myWindow = window.open("", "myWindow", "width=400, height=300");
}
function myClose(){
myWindow.close();
}
function myFunction(){
if(!myWindow)
x.innerHTML = "'myWindow' has never been opened!"
else if(myWindow.closed)
x.innerHTML = "'myWindow' has been closed!"
else
x.innerHTML = "'myWindow' has been opened!"
}
</script> </body>
</html>