272 Part III . Document Objects Reference (Free web hosting with ftp) Specifying
272 Part III . Document Objects Reference Specifying a window name Getting back to the other parameters of window.open(), the second parameter is the name for the new window. Don t confuse this parameter with the document s title, which would normally be set by whatever HTML text determines the content of the window. A window name must be the same style of one-word identifier that you use for other object names and variables. This name is also an entirely different entity than the windowobject that the open()method returns. You don t use the name in your scripts. At most, the name can be used for TARGETattributes of links and forms. Loading content into a new window A script generally populates a window with one of two kinds of information: . An existing HTML document whose URL is known beforehand . An HTML page created on the fly To create a new window that displays an existing HTML document, supply the URL as the first parameter of the window.open()method. If your page is having difficulty loading a URL into a new page (except as noted in the sidebar A Navigator 2 Bug Workaround ), try specifying the complete URL of the target document (instead of just the filename). Leaving the first parameter as an empty string forces the window to open with a blank document, ready to have HTML written to it by your script (or loaded separately by another statement that sets that window s location to a specific URL). If you plan to write the content of the window on the fly, assemble your HTML content as one long string value and then use the document.write()method to post that content to the new window. If you plan to append no further writing to the page, also include a document.close() method at the end to tell the browser that you re finished with the layout (so that the Layout:Complete or Donemessage appears in the statusbar, if your new window has one). A call to the window.open()method returns a reference to the new window s object if the window opens successfully. This value is vitally important if your script needs to address elements of that new window (such as when writing to its document). To allow other functions in your script to reference the subwindow, you should assign the result of a window.open() method to a global variable. Before writing to the new window the first time, test the variable to make sure that it is not a null value the window may have failed to open because of low memory, for instance. If everything is okay, you can use that variable as the beginning of a reference to any property or object within the new window. For example: var newWindow … function createNewWindow() { newWindow = window.open( , ) if (newWindow != null) { newWindow.document.write(
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.