O'Reilly logo

HTML, CSS and JavaScript All in One, Sams Teach Yourself: Covering HTML5, CSS3, and jQuery, Second Edition by Julie C. Meloni

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

Chapter 19. Responding to Events

What You’ll Learn in This Chapter:

How event handlers work

How event handlers relate to objects

How to create an event handler

How to detect mouse and keyboard actions

How to use onclick to change the appearance of <div>

In your experience with JavaScript so far, most of the scripts you’ve written have executed in a calm, orderly fashion, quietly and methodically moving from the first statement to the last. You’ve seen a few event handlers in use in sample scripts used to focus your attention on other aspects of programming, and it is likely that you used your common sense to follow along with the actions—onclick really does mean “when a click happens.” That alone speaks to the relative ease and simplicity ...

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