295Chapter 16 .Window and Frame Objects onHelp NN2 (Web hosting ratings)

January 9th, 2008

295Chapter 16 .Window and Frame Objects onHelp NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . The generic onHelpevent handler is discussed in Chapter 15, but it also fires when the user activates the context-sensitive help within a modal or modeless dialog box. In the latter case, a user can click the Help icon in the dialog box s title bar, at which time the cursor changes to a question mark. The user can then click on any element in the window. At that second click, the onHelp event handler fires, and the event object contains information about the element clicked (the event.srcElement is a reference to the specific element), allowing a script to supply help about that element. To prevent the brower s built-in help window from appearing, the event handler must evaluate to return false(IE4+) or set the event.returnValueproperty to false (IE5). Example The following script fragment can be embedded in the IE5-only modeless dialog box code in Listing 16-44 to provide context-sensitive help within the dialog box. Help messages for only two of the form elements are shown here, but in a real application you add messages for the rest. function showHelp() { switch (event.srcElement.name) { case bgColor :
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

294 Part III . Document Objects Reference there. (Mac os x web server)

January 9th, 2008

294 Part III . Document Objects Reference there. Because this event is a window event, you don t have to turn on window.captureEvents() to get the window to feel the effect of the event. The juiciest tidbit of the event, the URL of the dropped item, can be retrieved only with a signed script and the user s permission (see Chapter 46). Listing 16-44 shows a simple document that reveals the URL and screen location, as derived from the event object passed with the dragDrop event. You must have codebase principals turned on to get the full advantage of this listing, and it works best with Windows. Listing 16-44: Analyzing a dragDrop Event DragDrop Event Drag and Drop a file onto this window The dragDrop event is the only one that uses the data property of the NN4 event object. That property contains the URL. The target property reveals only the window object, but you can access the event object s screenX and screenY properties to get the location of the mouse release. Related Items: event object (Chapter 29). onError NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . . . See the discussion of the window.onerror property earlier in this chapter. windowObject.onError
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Msn web hosting - 293Chapter 16 .Window and Frame Objects Immediately after

January 8th, 2008

293Chapter 16 .Window and Frame Objects Immediately after the user clicks the OK button in the Print dialog box, the onBeforePrint event handler fires. As soon as the page(s) is sent to the printer or spooler, the onAfterPrint event handler fires. On the CD-ROM Example on the CD-ROM onBeforeUnload NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . Any user or scripted action that normally forces the current page to be unloaded or replaced causes the onBeforeUnload event handler to fire (not implemented in IE5/Mac). Unlike the onUnloadevent handler, however, onBeforeUnloadis a bit better behaved when it comes to allowing complex scripts to finish before the actual unloading takes place. Moreover, you can assign a string value to the event. returnValue property in the event handler function. That string becomes part of a message in an alert window that gives the user a chance to stay on the page. If the user agrees to stay, the page does not unload, and any action that caused the potential replacement is cancelled. On the Example (with Listing 16-43) on the CD-ROM CD-ROM Related Items: onUnload event handler. onDragDrop NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . With closer integration between the computer desktop and browsers these days, it is increasingly possible that shortcuts (or aliases) to Web URLs can be represented on our desktops and other kinds of documents. With NN4, you can script awareness of dragging and dropping of such items onto the browser window. The window s dragDrop event fires whenever a user drops a file or other URL-filled object onto the window. You can add an onDragDrop event handler to the tag of your document and pass along the event object that has some juicy tidbits about the drop: the object on which the item was dropped and the URL of the item. The function called by the event handler receives the event object information and can process it from windowObject.onDragDrop
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

292 Part III . (Web server address) Document Objects Reference stop()

January 8th, 2008

292 Part III . Document Objects Reference stop() Returns: Nothing. Compatibility NN2 NN3 NN4 . NN6 . IE3/J1 IE3/J2 IE4 IE5 IE5.5 The Navigator-specific stop()method offers a scripted equivalent of clicking the Stop button in the toolbar. Availability of this method allows you to create your own toolbar on your page and hide the toolbar (in the main window with signed scripts or in a subwindow). For example, if you have an image representing the Stop button in your page, you can surround it with a link whose action stops loading, as in the following: A script cannot stop its own document from loading, but it can stop loading of another frame or window. Similarly, if the current document dynamically loads a new image or a multimedia MIME type file as a separate action, the stop() method can halt that process. Even though the stop() method is a window method, it is not tied to any specific window or frame: Stop means stop. Related Items: window.back(), window.find(), window.forward(), window.home(), window.print() methods. Event handlers onAfterPrint onBeforePrint NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . Each of these event handlers (not implemented in IE5/Mac) fires after the user has clicked the OK button in IE s Print dialog box. This goes for printing that is invoked manually (via menus and browser shortcut buttons) and the window.print() method. Although printing is usually WYSIWYG, it is conceivable that you may want the printed version of a document to display more or less of the document than is showing at that instant. For example, you may have a special copyright notice that you want printed at the end of a page whenever it goes to the printer. In that case, the element with that content can have its display style sheet property set to none when the page loads. Before the document is sent to the printer, a script needs to adjust that style property to display the element as a block item; after printing, have your script revert the setting to none. windowObject.onAfterPrint
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

291Chapter 16 .Window and Frame (How to cite a web site) Objects One of

January 7th, 2008

291Chapter 16 .Window and Frame Objects One of the reasons I call a dialog box window an (almost) window object is that some normal behavior is not available in IE4. For example, if you load a frameset into the dialog box window, scripts in documents within the frames cannot refer back to the parent document to access variables or parent window methods. Thus, a button in a frame of an IE4 modal dialog box cannot issue parent.close() to close the dialog box. This anomaly is repaired in IE5. On the CD-ROM Example (with Listings 16-39 through 16-42) on the CD-ROM Related Items: window.open() method. sizeToContent() Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . The NN6 window.sizeToContent() method can be a valuable aid in making sure that a window (especially a subwindow) is sized for the optimum display of the window s content. But you must also be cautious with this method, or it will do more harm than good. Invoking the sizeToContent() method resizes the window so that all content is visible. Concerns about variations in OS-specific rendering become a thing of the past. Naturally, you should perform this action only on a window whose content at the most occupies a space smaller than the smallest video monitor running your code (typically 640 480 pixels, but conceivably much smaller for future versions of the browser used on handheld computers). You can get the user in trouble, however, if you invoke the method twice on the same window that contains the resizing script. This action can cause the window to expand to a size that may exceed the pixel size of the user s video monitor. Successive invocations fail to cinch up the window s size to its content again. Multiple invocations are safe, however, on subwindows when the resizing script statement is in the main window. On the Example on the CD-ROM CD-ROM Related Item: window.resizeTo() method. windowObject.sizeToContent()
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

290 Part III . Document Objects (Database web hosting) Reference Table

January 7th, 2008

290 Part III . Document Objects Reference Table 16-4 IE Dialog Box Window Features Feature Type Default Description center Boolean yes Whether to center dialog box (overridden by dialogLeft and/or dialogTop). dialogHeight Length varies Outer height of the dialog box window. IE4 default length unit is em; IE5 is pixel (px). dialogLeft Integer varies Pixel offset of dialog box from left edge of screen. dialogTop Integer varies Pixel offset of dialog box from top edge of screen. dialogWidth Length varies Outer width of the dialog box window. IE4 default length unit is em; IE5 is pixel (px). help Boolean yes Display Help icon in title bar. resizable Boolean no Dialog box is resizable (IE5+ only). status Boolean varies Display statusbar at window bottom (IE5+ only). Default is yes for untrusted dialog box; no for trusted dialog box. The CSS-type of syntax for these features lets you string multiple features together by separating each pair with a semicolon within the string. For example: var dlogData = showModalDialog( prefs.html , defaultData, dialogHeight:300px; dialogWidth:460px; help:no ) Although not explicitly listed as one of the window features, scroll bars are normally displayed in the window if the content exceeds the size assigned or available to the dialog box. If you don t want scroll bars to appear, have your dialog box document s script set the document.body.scroll property to falseas the page opens. Dialog cautions A potential user problem to watch for is that typically a dialog box window does not open until the HTML file for the dialog box has loaded. Therefore, if there is substantial delay before a complex document loads, the user does not see any action indicating that something is happening. You may want to experiment with setting the cursorstyle sheet property and restoring it when the dialog box s document loads. windowObject.showModalDialog()
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

Web hosting domain - 289Chapter 16 .Window and Frame Objects The makeup

January 6th, 2008

289Chapter 16 .Window and Frame Objects The makeup and content of the returned data is in the hands of your scripts. No data is automatically returned for you. Because a modeless dialog box coexists with your live main page window, returning data is not as straightforward as for a modal dialog box. The second parameter of the showModelessDialog() method takes on a special task that isn t exactly the same as passing parameters to the dialog box. Instead, if you define a global variable or a function in the main window s script, pass a reference to that variable or function as the second parameter to display the modeless dialog box. A script in the modeless dialog box can then point to that reference as the way to send data back to the main window before the dialog box closes (or when a user clicks something, such as an Apply button). This mechanism even allows for passing data back to a function in the main window. For example, say that the main window has a function defined as the following: function receivePrefsDialogData(a, b, c) { // statements to process incoming values // } Then pass a reference to this function when opening the window: dlog = showModelessDialog( prefs.html , receivePrefsDialogData) A script statement in the dialog box window s document can pick up that reference so that other statements can use it, such as a function for an Apply button s onClick event handler: var returnFunc = window.dialogArguments … function apply(form) { returnFunc(form.color.value, form.style.value, form.size.value) } While this approach seems to block ways of getting parameters to the dialog box when it opens, you can always reference the dialog box in the main window s script and set form or variable values directly: dlog = showModelessDialog( prefs.html , receivePrefsDialogData) dlog.document.forms[0].userName.value = GetCookie( userName ) Be aware that a dialog box window opened with either of these methods does not maintain a connection to the originating window via the openerproperty. The opener property for both dialog box types is undefined. Dialog window features Both methods provide an optional third property that lets you specify visible features of the dialog box window. Omitting the property sets all features to their default values. All parameters are to be contained by a single string, and each parameter s name-value pair is in the form of CSS attribute:value syntax. Table 16-4 lists all of the window features available for the two window styles. If you are designing for compatibility with IE4, you are restricted to the modal dialog box and a subset of features, as noted in the table. All values listed as Boolean take only the following four values: yes, no, 1, 0. windowObject.showModalDialog()
Check Tomcat Web Hosting services for best quality webspace to host your web application.

288 Part III . Document Objects Reference (Web server logs) showModalDialog( URL [,

January 6th, 2008

288 Part III . Document Objects Reference showModalDialog( URL [, arguments] [, features]) showModelessDialog( URL [, arguments] [, features]) Returns: returnValue (modal) or window object (modeless). Compatibility NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 ( ) IE5 . IE5.5 . IE4+ provides methods for opening a modal dialog box window, which always stays in front of the main browser window while making the main window inaccessible to the user. In IE5 (but not IE5/Mac), Microsoft added the modeless type of dialog box, which also stays in front, but allows user access to whatever can be seen in the main window. You can load any HTML page or image that you like into the dialog box window, by providing a URL as the first parameter. Optional parameters let you pass data to a dialog box and give you considerable control over the look of the window. Unfortunately, these types of dialog box windows are not available in Navigator. At best, you can simulate modal and modeless dialog box windows, but the job is not for beginners (see http://developer.netscape.com/viewsource/ goodman_modal/goodman_modal.htmlfor one example). The windows generated by both methods are (almost) full-fledged window objects with some extra properties that are useful for what these windows are intended to do. Perhaps the most important property is the window.dialogArgument property. This property lets a script read the data that is passed to the window via the second parameter of both showModalDialog() and showModelessDialog(). Passed data can be in any valid JavaScript data type, including objects and arrays. Displaying a modal dialog box has some ramifications for scripts. In particular, script execution in the main window halts at the statement that invokes the showModalDialog() method as long as the modal dialog box remains visible. Scripts are free to run in the dialog box window during this time. The instant the user closes the dialog box, execution resumes in the main window. A call to show a modeless dialog box, on the other hand, does not halt processing because scripts in the main page or dialog box window are allowed to communicate live with the other window. Retrieving dialog data To send data back to the main window s script from a modal dialog box window, a script in the dialog box window can set the window.returnValueproperty to any JavaScript value. It is this value that gets assigned to the variable receiving the returned value from the setModelDialog() method, as shown in the following example: var specifications = window.showModalDialog( preferences.html ) windowObject.showModalDialog()
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Web hosting rating - 287Chapter 16 .Window and Frame Objects JavaScript provides

January 5th, 2008

287Chapter 16 .Window and Frame Objects JavaScript provides no built-in equivalent for a wait command. The worst alternative is to devise a looping function of your own to trap script execution for a fixed amount of time. In NN3+, you can also use LiveConnect (see Chapter 44) to invoke a Java method that freezes the browser s thread for a fixed amount of time. Unfortunately, both of these practices prevent other processes from being carried out, so you should consider reworking your code to rely on a setTimeout() method instead. NN4+ provides a mechanism for passing parameters to functions invoked by setTimeout(). See the section Passing Parameters in the discussion of window.setInterval() for details on this and passing parameters in other browser versions. As a note to experienced programmers, neither setInterval() nor setTimeout() spawn new threads in which to run their invoked scripts. When the timer expires and invokes a function, the process gets at the end of the queue of any pending script processing in the JavaScript execution thread. On the CD-ROM Example (with Listing 16-38) on the CD-ROM Related Items: window.clearTimeout(), window.setInterval(), window.clearInterval() methods. showHelp( URL ,[ contextID ]) Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . The IE-specific showHelp() method (not implemented in IE5/Mac) lets a script open a Winhelp window with a particular .hlpfile. This method is specific to the Win32 operating systems. If your Winhelp file has context identifiers specified in various places, you can pass the ID as an optional second parameter. This lets the call to showHelp() navigate to a particular area of the .hlpfile that applies to a specific element on the page. Example See the Microsoft Visual Studio authoring environment for details on building Winhelp files. windowObject.showHelp()
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Web site templates - 286 Part III . Document Objects Reference chapter.)

January 5th, 2008

286 Part III . Document Objects Reference chapter.) Multiple timers can run concurrently and are completely independent of each other. While the primary functionality of the setTimeout()method is the same in both NN and IE, each browser offers some extra possibilities depending on the way you use parameters to the method. For simple invocations of this method, the same parameters work in all browsers that support the method. I first address the parameters that all browsers have in common. The expression that comprises the first parameter of the method window.setTimeout() is a quoted string that can contain either a call to any function or method or a standalone JavaScript statement. The expression evaluates after the time limit expires. Understanding that this timeout does not halt script execution is very important. In fact, if you use a setTimeout() method in the middle of a script, the succeeding statements in the script execute immediately; after the delay time, the expression in the setTimeout()method executes. Therefore, I ve found that the best way to design a timeout in a script is to plug it in as the last statement of a function: Let all other statements execute and then let the setTimeout()method appear to halt further execution until the timer goes off. In truth, however, although the timeout is holding, the user is not prevented from performing other tasks. And after a time- out timer is ticking, you cannot adjust its time. Instead, clear the timeout and start a new one. If you need to use setTimeout()as a delay inside a function, break the function into two parts, using the setTimeout() method as a bridge between the two functions. You can see an example of this in Listing 16-26, where IE needs a little delay to finish opening a new window before content can be written for it. If it weren t for the required delay, the HTML assembly and writing would have been accomplished in the same function that opens the new window. It is not uncommon for a setTimeout()method to invoke the very function in which it lives. For example, if you have written a Java applet to perform some extra work for your page and you need to connect to it via LiveConnect, your scripts must wait for the applet to load and carry out its initializations. While an onLoadevent handler in the document ensures that the applet object is visible to scripts, it doesn t know whether the applet has finished its initializations. A JavaScript function that inspects the applet for a clue might need to poll the applet every 500 milliseconds until the applet sets some internal value indicating all is ready, as shown here: var t function autoReport() { if (!document.myApplet.done) { t = setTimeout( autoReport() ,500) } else { clearTimeout(t) // more statements using applet data // } } windowObject.setTimeout()
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.