Closing Windows
============================================== CLOSING WINDOWS FROM JAVASCRIPT - Six Methods ============================================== Copyright 2001 by www.CodeBelly.com Do *not* remove this notice. ============= INSTRUCTIONS: ============= There are six slightly different scripts below. In cases where images are used, replace the image name with the name of your own image. Other than that, just insert the code as shown into your page wherever you wish the closing link, image, or button to appear. Special Note on Frameset Pages: Closing windows that are comprised of a frameset requires that you ask to close the "topmost" window, *not* the page that contains the JavaScript closing code. Thus, where window.close() will work fine with a regular page, it will often fail (depending on the browser) when attempting to close a window comprised of frameset pages. In this case, the JavaScript closer must ask for top.window.close() instead. Other Background: Before you ask... if a window is *not* a popup to begin with, window.close() JavaScript calls will normally result in a browser message requesting confirmation that you wish to close the window. There is no means in most browsers to avoid or circumvent this. ============ THE SCRIPTS: ============ 1. Closing a Regular Window from a Link Click ---------------------------------------------
Close
2. Closing a Regular Window from an Image Click -----------------------------------------------
3. Closing a Regular Window from a Button Click -----------------------------------------------
4. Closing a Frameset Window from a Link Click ----------------------------------------------
Close
5. Closing a Frameset Window from an Image Click ------------------------------------------------
6. Closing a Frameset Window from a Button Click ------------------------------------------------
Back