Chapter 6

Playing with the Document Object Model

IN THIS CHAPTER

Bullet Understanding objects

Bullet Messing with object properties and methods

Bullet Taking a deep dive into the Document Object Model

Bullet Figuring out events

Bullet Handling mouse clicks, keypresses, and more

The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures.

—FRED BROOKS

I’ve talked a lot of JavaScript over the past few chapters, but in a very real sense all that has been just the programming equivalent of noshing on a few appetizers. Now it’s time to sit down for the main course: programming the Document Object Model. I explain what that is shortly, but for now it’s enough to know that it means taking control over every aspect of the web page. Want to change some web page text on the fly? JavaScript ...

Get HTML, CSS, & JavaScript All-in-One For Dummies 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.