2.3 The Document Object
Every Window object has a document property that
refers to a Document object. The Document object is arguably more
important than the Window object itself: while the Window represents
the browser window, the Document object represents the HTML document
that is displayed in that window. The Document object has various
properties that refer to other objects which allow access to and
modification of document content. The way that document content is
accessed and modified is called the document object model, or DOM,
and there are several DOMs in existence:
- Legacy DOM
-
The original legacy document object model evolved along with early
versions of the JavaScript language. It is well supported by all
browsers, but allows access only to certain key portions of
documents, such as forms, form elements, and images.
- W3C DOM
-
This document object model allows access and modification of all
document content and is standardized by the World Wide Web Consortium
(W3C). It is at least partially supported by Netscape 6 and later,
Internet Explorer 5 and later, and other modern browsers. The W3C DOM
is not closely compatible with the IE 4 DOM, but it does standardize
many of the legacy features of the original DOM. This book covers the
core features of the standard, and presents a simplified subset of
the DOM relevant for JavaScript programmers working with HTML
documents. You can find complete coverage in JavaScript:
The Definitive Guide.
- IE 4 DOM
-
Microsoft's Internet Explorer Version 4 extended the
legacy DOM with powerful new features for accessing and modifying all
content of a document. These features were never standardized, but
some of them are supported in non-Microsoft browsers.
The following sections explain each of these DOMs in more detail and
describe how you can use them to access and modify document content.
|