HTML and CSS Reference
In-Depth Information
Figure 13-4
versions of the document object model
Document Object Model
Description
Internet Explorer DOM
A document object model provided for the Internet Explorer
browser and including features not found in any W3C DOM
W3C DOM Level 1
The first DOM specification by the W3C, which supported all page
and browser elements and handled all events occurring within the
browser
W3C DOM Level 2
The second DOM specification, allowing for the capture of events,
manipulation of CSS styles, working with element text, and docu-
ment subsets
W3C DOM Level 3
The third DOM specification, providing a framework for working
with document loading and saving, as well as working with DTDs
and document validation
HTML5 DOM
The latest document object model based on HTML5 (still in develop-
ment at the time of this writing)
The Object Tree
Objects are organized into a hierarchy known as an object tree . The 13.1 Visual
Overview shows a portion of this tree with the window object, representing the browser
window, as the topmost object in the hierarchy. Contained within the browser window are
objects for the Web page document displayed within the browser, each frame displayed
within the browser, the history of Web pages visited, and even the browser itself. Those
objects can contain yet another level of objects. For example, the document object con-
tains objects for Web forms, images, applets, inline frames, and hypertext links.
It's important to note that document objects can be referenced only after the browser
has finished loading the page . Any command that references a document object before
the page is loaded will return an error because those objects do not yet reside in memory.
Referencing Objects
Each object within the hierarchy is referenced by its object name . Figure 13-5 lists the
object names for some of the objects at the top of the object hierarchy. Note that you've
been using one of these objects, the document object, throughout the last three tutorials.
Figure 13-5
Object names
Object Name
Description
window
The browser window
document
The Web document displayed in the window
document.body
The body of the Web document displayed in the browser window
event
Events or actions occurring within the browser window
history
The list of previously visited Web sites within the browser window
location
The URL of the document currently displayed in the browser window
navigator
The browser itself
screen
The screen displaying the document
 
Search WWH ::




Custom Search