Chapter 12. Working with JavaScript
You learned the key concepts behind the JavaScript language in Chapter 11; in this chapter, you see how these concepts come together in working scripts. By examining many examples, you learn different ways in which JavaScript can interact with your web pages. You also learn some new coding practices for writing your own JavaScripts, and some very helpful shortcuts to creating interactive pages.
The chapter covers the following major topics, each relating to different JavaScript techniques or parts of documents:
Validation of forms: Checking that a user has filled in the appropriate form elements and has put a value that matches what you expect
Other forms techniques: Giving focus to elements when the page loads, auto tabbing between fields, disabling controls, and converting text case
Navigation: Image rollovers and highlighting navigation items
Windows: Creating pop-ups
Using existing libraries: Taking a look at three existing JavaScript libraries that can give you complex functionality with just a few lines of code
By the end of the chapter, not only will you have learned a lot about using JavaScript in your pages, but you will also have a library of helpful functions you can use in your own pages.
Practical Tips for Writing Scripts
Before you start looking at the examples, there are a few practical hints on developing JavaScripts that should save you time.
Has Someone Already Written This Script?
Thousands of free JavaScripts are already out there on ...
Get Beginning Web Programming with HTML, XHTML, and CSS, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.