O'Reilly logo

Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day: Includes New HTML5 Coverage, Sixth Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 15. Using JavaScript in Your Pages

Now that you have some understanding of what JavaScript is all about, you’re ready to look at some practical applications of JavaScript.

In this lesson, you learn how to complete the following tasks:

• Validate the contents of a form

• Create a list that expands and collapses

• Modify the styles of elements on a page dynamically

Validating Forms with JavaScript

Remember the example form that you created back in Lesson 11, “Designing Forms?” It’s shown again in Figure 15.1. It’s a typical registration form for a website with several required fields.

Figure 15.1 The registration form.

image

What happens when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required