Hello,
I want to close a window using a java script, I have a piece of code but that is not working. So, if you know how to do this or if you can give me some idea to do this then it will be appreciated. Thank you for your help.
Hello,
I want to close a window using a java script, I have a piece of code but that is not working. So, if you know how to do this or if you can give me some idea to do this then it will be appreciated. Thank you for your help.
Hello,
This is the code you are looking for
Code:<html> <head> <title>Window close </title> </head> <SCRIPT language="JavaScript1.2"> function popuponclick() { testwindow = window.open("", "mywindow","status=1,width=350,height=150"); testwindow.document.write('<H1>The Popup Window</H1>'); } function clpop() { if(false == testwindow.closed) { testwindow.close (); } else { alert('Window already closed!'); } } </SCRIPT> <body> <P> <A href="javascript: popuponclick()">Open Popup Window</A> </P> <P> <A href="javascript: clpop()">Close the Popup Window</A> </P> </body> </html>
Hello,
The above is correct alternatively you can also try the following
Code:<html> <head> <title>Test close window</title> <script language="JavaScript"> <!-- function opwn(){ window.open('example.html', ''); window.close(); } // --> </script> </head> <body onload="window.opener='';opwn()"> </body> </html>
Hello,
Even this can help
Code:<SCRIPT language="JavaScript"> <!-- var brwnm=navigator.appName; if (brwnm=="Netscape") { function clwinnm() { window.open('','_parent',''); window.close();} } else { if (brwnm=="Microsoft Internet Explorer") { function clwinnm() { window.opener = "whocares"; window.close(); } } }
Hey,
Take a look at the following code
Code:<script> function handunld() { event.returnValue = "Click cancel to return to the blah"; } </script> <body onbeforeUnload="handunld()">
Hello,
Take a look at the following code
Code:function clallwind() { for(var x=0;x<children.length;x++) {children[x].close(); } //Oh, and close self! window.close(); }
Hello,
This code can help you
Code:<script type="text/javascript"> function nwwind() { var dy = new Date(); var id=dy.getTime(); var args = 'width=400,height=400,scrollbars,resizable'; var message='<p><a href="#" onClick="setTimeout(\'window.close()\',500);return false;">'+ 'This window will self-destruct half a second after you click this link</a></p>'+ '<form><input type="button" onClick="setTimeout(\'window.close()\',500);"'+ ' value="Or click this button"></form>'; var win=open('',id,args); win.document.write(message); win.document.close(); return false; } </script>
Bookmarks