165Chapter 14Document Object Model Essentialswith resides within the (Web design)

165Chapter 14Document Object Model Essentialswith resides within the browser application. With few exceptions, a script does not accessanything about your computer hardware, operating system, other applications, desktop, orany other stuff beyond the browser program. The browser document object road mapFigure 14-1 shows the lowest common denominator document object hierarchy that is imple- mented in all scriptable browsers. Notice that the windowobject is the topmost object in theentire scheme. Everything you script in JavaScript is in the browser s window. Figure 14-1:The lowest common denominator browser document object hierarchy. Pay attention to the shading of the concentric rectangles. Every object in the same shadedarea is at the same level relative to the windowobject. When a line from an object extends tothe next darker shaded rectangle, that object contains all the objects in darker areas. Thereexists, at most, one of these lines between levels. The windowobject contains the documentobject; the documentobject contains a form object; a form object contains many differentkinds of form control elements. Study Figure 14-1 to establish a mental model for the basic scriptable elements of a Webpage. Models of more recent browsers have more objects in their hierarchies, but the fun- damental organization remains. After you script these objects several times, the objecthierarchy will become second nature to you even if you don t necessarily rememberevery detail (property, method, and event handler) of every object. At least you knowwhere to look for information. How Document Objects Are BornMost of the objects that a browser creates for you are established when an HTML documentloads into the browser. The same kind of HTML code you use to create links, anchors, andinput elements tells a JavaScript-enhanced browser to create those objects in memory. Theobjects are there whether or not your scripts call them into action. windowframe self top parenthistory document location text radio button selecttextarea checkbox reset optionlink form anchor password submit