The most viewed posts

Registry Reviver

Web Development Services

Contact Me

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

How to make a computer secure and run faster

Myanmar font and keyboard for Windows

Advanced System Care

The most viewed items

Dell Inspiron 5559

Desktop Hard Disk

Laptop RAM

HP ProBook 430

SONY Playstation Portable

External Hard Disk

Laptop

Please login to start chat

ZilaStar ICT Jul 26 2022, 11:37:55
Category : JavaScript Tutorials

close (HTML DOM Window)

<!DOCTYPE html>
<html>
<head>
<title>Js Code Testing</title>
</head>
<body>
<div id = "msg"></div>
<button onclick = "openWin()">Open Window</button>
<button onclick = "closeWin()">Close Window</button>
<button onclick = "chkStatus()">Check Status</button>

<script>

var myWin;

function openWin(){
myWin = window.open("", "myWin", "width=300px, height=200px");
}

function closeWin(){
if(myWin){
myWin.close();
}
}

function chkStatus(){
if(!myWin){
document.getElementById("msg").innerHTML = "Window has never been opened.";
}else{
if(myWin.closed){
document.getElementById("msg").innerHTML = "Window has been closed.";
}else{
document.getElementById("msg").innerHTML = "Window stills opend.";
}
}
}

</script>
</body>
</html>

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions