15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

182<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

Listing 16-40 (continued)<br />

Goldenrod<br />

Lime<br />

Powder Blue<br />

Slate Gray<br />

<br />

<br />

<br />

Select a text color:<br />

<br />

Black<br />

White<br />

Navy Blue<br />

Dark Orange<br />

Sea Green<br />

Teal<br />

<br />

<br />

<br />

Select “Welcome” heading font point size:<br />

<br />

12<br />

14<br />

18<br />

24<br />

32<br />

48<br />

<br />

<br />

<br />

<br />

<br />

OK&nbsp;&nbsp;<br />

Cancel<br />

<br />

<br />

<br />

One last convenience feature of the dialog box window is the onKeyPress event<br />

handler in the text box. The function it invokes looks for the Enter key. If that key is<br />

pressed while the box has focus, the same handleOK() function is invoked, as if the<br />

user had clicked the OK button. This feature makes the dialog box behave as if the<br />

OK button is an automatic default, just as “real” dialog boxes.<br />

You should observe several important structural changes that were made to turn<br />

the modal approach into a modeless one. Listing 16-41 shows the version of the<br />

main window modified for use with a modeless dialog box. Another global variable,<br />

prefsDlog, is initialized to eventually store the reference to the modeless window<br />

windowObject.showModalDialog()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!