HTML and CSS Reference
Objects.” The elements can be accessed in two ways: by name or by number. If, for exam-
ple, you name the first form,“form1”, then you can access it by name (associative array)
as document.forms[“form1”] or by numeric index value (numeric array) as docu-
We discussed the window as part of the BOM in the last chapter. The DOM is concerned
only with those nodes that make up the document object. Documents contain text,
images, forms, links, anchors, and so on. The most commonly used object is the docu-
ment object . Subordinate to the document object are another collection of objects, its chil-
dren (see Figures 11.1):
1. The anchors object.
2. The images object.
3. The forms object.
4. The links object.
Figure 11.1 The document model.
Revisiting the Dot Syntax. T o refer to an object, you start with the window object
( parent ), followed by a dot, then the next object in the hierarchy, then another dot, and so
on until you reach the desired object; for example, window.location or window.docu-
ment.forms . When referencing a child of the window object, it is not necessary to include