22.04.2013 Views

HTML, XHTML & CSS

HTML, XHTML & CSS

HTML, XHTML & CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

12<br />

Part IV: Scripting and (X)<strong>HTML</strong><br />

Finding Out What JavaScript<br />

Can Do for Your Pages<br />

Adding scripts to your Web site is much like those reality-TV makeover<br />

shows that transform a house or a person’s appearance into something<br />

completely new and wonderful. The same is true with JavaScript. You can<br />

transform a plain, dull Web page into an interactive and dynamic Web extravaganza<br />

to bring joy to your visitors for years to come. (Okay, maybe we’re<br />

exaggerating just a tad, but you get the point.)<br />

For example, if you visit Dummies.com (www.dummies.com) and click the<br />

blue Search button next to the Start Exploring box without entering a term to<br />

search on, the browser displays a nice warning box that reminds you to enter<br />

a search term before you actually search, as shown in Figure 13-1.<br />

Figure 13-1: The search term is empty — that is, missing.<br />

A short script verifies whether you entered a search term before the engine<br />

runs the query:<br />

✓ If you enter a search term, you don’t see the warning.<br />

✓ If you don’t enter a search term, the script built into the page prompts<br />

the dialog box to appear.

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

Saved successfully!

Ooh no, something went wrong!