Javascript window close
-
Hello, i tried closing a window using the code snippet It seems not to work, does anybody know why or an alternative way.
-
Hello, i tried closing a window using the code snippet It seems not to work, does anybody know why or an alternative way.
What you have posted won't work because you have commented it out. The following will work to close a window. If the window is the parent window (the only window open) you get a message box asking "Do you want to close this window?".
<a href="javascript:window.close();">Close Me</a>
This works with Internet Explorer but probably won't work with other browsers. You can also use a button or image. Using the elements 'OnClick' event handler you can call a script function to close the window also. This is usually done for popup windows. Mark