Web hosting mysql - 86Part IIJavaScript TutorialIf you issue window.close(), self.close(), or
86Part IIJavaScript TutorialIf you issue window.close(), self.close(), or just close()in the main window s script, the method closes the main window (after confirming with the user) and not the subwindow. To address another window, then, you must include a reference to that window as part of thecomplete reference. This has an impact on your code because you probably want the variableholding the reference to the subwindow to be valid as long as the main document is loadedinto the browser. For that to happen, the variable has to be initialized as a global variable, rather than inside a function (although you can set its value inside a function). That way, onefunction can open the window while another function closes it. Listing 8-1 is a page that has a button for opening a blank, new window and closing that win- dow from the main window. To view this demonstration, shrink your main browser window toless than full screen. Then when the new window is generated, reposition the windows so youcan see the smaller, new window when the main window is in front. (If you lose a windowbehind another, use the browser s Window menu to choose the hidden window.) The keypoint of Listing 8-1 is that the newWindowvariable is defined as a global variable so that boththe makeNewWindow()and closeNewWindow()functions have access to it. When a variable isdeclared with no value assignment, its initial value is null. A nullvalue is interpreted to bethe same as falsein a condition, while the presence of any non-zero value is the same astruein a condition. Therefore, in the closeNewWindow()function, the condition testswhether the window has been created before issuing the subwindow s close()method. Then, to clean up, the function sets the newWindowvariable to nullso that another click ofthe Close button doesn t try to close a nonexistent window. Listing 8-1:References to Window Objects
Note: In case you are looking for affordable webhost to host and run your web application check Vision cheap hosting services