HTML and CSS Reference
window as an object, a window that can be resized, opened, closed, and so on. It sees all
the frames, documents, images, and widgets inside the window as objects. And these
objects have properties and methods.
1. User-defined objects defined by the programmer.
2. Core or built-in objects, such as Date, String, and Number (see Chapter 9,
3. Browser objects, the BOM (see Chapter 10, “It's the BOM! Browser Objects”).
4. The Document objects, the DOM (see Chapter 15, “The W3C DOM and Java-
This chapter focuses on user-defined objects, objects that you will create and manipu-
objects will be much easier to understand and use.
An object model is a hierarchical tree-like structure used to describe all of the compo-
nents of an object (see Figure 8.1). For example, in Chapter 1, “Introduction to Java-
Script,” we discussed the DOM (see more in Chapter 15), a tree-like structure that
represents an HTML document and all of its elements, and this tree-like model is also
objects and user-defined objects use this same model. When accessing an object in the
tree, the object at the top of the tree is the root or parent of all parents. If there is an
object below the parent it is called the child, and if the object is on the same level, it is
a sibling. A child can also have children. A dot (.) is used to separate the objects when
descending the tree; for example, a parent is separated from its child with a dot. In the
other objects are derived and the Object object has its own properties and methods that
all objects will have access to. (We list these properties and methods in Tables 8.1 and
8.2.) The cat object and the dog object are derived from the Object object . To get the cat's
name, you would say cat.name, and to get the dog's breed you would say dog.breed . The
Object object is not named when going down in the hierarchy.
Figure 8.1 A hierarchical tree-like structure used to describe components of an object.