Archive for November, 2007

CD-310 Part VI . Appendixes The dialog box s (Vps web hosting)

Wednesday, November 21st, 2007

CD-310 Part VI . Appendixes The dialog box s document, shown in Listing 16-40, is responsible for reading the incoming data (and setting the form elements accordingly) and assembling form data for return to the main window s script. Notice when you load the example that the TITLE element of the dialog box s document appears in the dialog box window s title bar. When the page loads into the dialog box window, the init() function examines the window.dialogArguments property. If it has any data, the data is used to pre-set the form elements to mirror the current settings of the main page. A utility function, setSelected(), pre-selects the option of a SELECT element to match the current settings. Buttons at the bottom of the page are explicitly positioned to be at the lower-right corner of the window. Each button invokes a function to do what is needed to close the dialog box. In the case of the OK button, the handleOK()function sets the window.returnValueproperty to the data that come back from the getFormData() function. This latter function reads the form element values and packages them in an array using the form elements names as array indices. This helps keep everything straight back in the main window s script, which uses the index names, and is therefore not dependent upon the precise sequence of the form elements in the dialog box window. Listing 16-40: Document for the Modal Dialog User Preferences