window.closed()

window.closed method will tell us the status of the window ( open or close ) . Here is the syntax
window.closed();
We have used Ajax Message to display messages You can see the source code of this demo here
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Demo of closed window</title>
<script language=javascript>

function to_close(){
tm.close();
}
function to_open(){
tm=window.open("moveby-
child.htm","Ratting","width=250,height=150,left=150,0,top=200,status=0,"); } function to_focus(){ if(tm.closed){ document.getElementById('msg').innerHTML=" Window is closed , first open it "; setTimeout("document.getElementById('msg').style.display='none'",2000); }else{ document.getElementById('msg').innerHTML=" Window is focused"; setTimeout("document.getElementById('msg').style.display='none'",2000); tm.focus(); // Keeping the focus on small window
} } function to_blur(){ if(tm.closed){ document.getElementById('msg').innerHTML=" Window is closed , first open it "; setTimeout("document.getElementById('msg').style.display='none'",2000); }else{ document.getElementById('msg').innerHTML=" Window is blured "; setTimeout("document.getElementById('msg').style.display='none'",2000); tm.blur(); // Keeping the focus out on small window } } </script> </head> <body > <input type="button" name="btn" value="Open" onclick="to_open()";> <input type="button" name="btn" value="Close" onclick="to_close()";> <input type="button" name="btn" value="Focus" onclick="to_focus()";> <input type="button" name="btn" value="Blur" onclick="to_blur()";> <br><br> Open the window, then close and they try to Blur <div id=msg style="position:absolute; width:300px; height:25px; z-index:1; left: 400px; top: 0px; border: 1px none #000000"></div><br><br> </body> </html>


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer