14. Learning About an Object

In Chapter 12, we looked at how to turn an element defined by HTML tags into an object that can then be addressed by the Document Object Model. The DOM allows you to find out information about the object—such as its size, location, and whether it is visible—using JavaScript.

All the information gained about the environment in Chapter 13 was derived from asking the browser questions, such as its type and screen size. In this chapter, we will be looking at what information can be gained by querying objects in the browser window for information about themselves.

Detecting Which Object Was Clicked

In Chapter 12, I showed you how to use evt to find the object in which an event originated. Using the browser’s DOM, though, ...

Get CSS, DHTML, and Ajax: Visual QuickStart Guide, Fourth 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.