Web hosting domain - 289Chapter 16 .Window and Frame Objects The makeup
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.