JavaScript Window Function Guide Close window
(Author: hear the wind compiler 2001 at 11:35 on January 19)
When you create a new window, allocate the return value of the Open () method to a variable is very important. For example, the following statement is to create a new window, then close it immediately: win = window.open ("http://www.docjs.com/", "js"); win.close (); each browser The window is clearly written with a Window object, so when you want to quote the current window, you should use the Window object. The following statement sets the URL of the current window: window.location.href = "http://www.docjs.com/" When you place such a statement in the script, you don't need to specify the Window object, because the current window The existence is the default: location.href = "http://www.docjs.com/"; pay attention, Self is equivalent to Window, so self.close () is actually equal to Window.Close (). Window.location.href = "http://www.docjs.com/"; Close Window.close () Close the specified browser window. If the close () function is called without a window reference, JavaScript turns off the current window. In an event handler, you must specify Window.Close () without using Close (). Due to the scope of JavaScript total static object, a close () call without object name is equivalent to document.close (). If you perform a close () method to close a window that is not opened by the script, a confirmation dialog will have a confirmation dialog to select whether to close the window. If there is only a record in the historical list, the dialog box will not appear in the Navigator. However, if you use Close () to exit the last running browser instance, the confirmation dialog will appear.
See the dialog box that appears in the 2 type browser looks: Click on the link below to open a new window, where the content is tryclose.html: launch window (with javascript) Launch Window (with html) 1st link using JavaScript Window.Open () method to open a window, the second link simply use the target property to achieve the same purpose: Launch WINDOW (with JavaScript)
launch window tryclose.html Display a button, it is responsible for performing Window.Close () Method: