32
|
JavaScript Pocket Reference
example, to define functions in the <head> of a top-level win-
dow, and then have scripts and event handlers in nested
frames call those functions using the
top property:
// Code in a frame calls code in the top-level window.
top.stop_scrolling();
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 repre-
sents 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 doc-
ument 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 modifica-
tion of all document content and is standardized by the
World Wide Web Consortium (W3C). It is at least par-
tially 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 fea-
tures of the original DOM. This book covers the core fea-
tures of the standard, and presents a simplified subset of
the DOM relevant for JavaScript programmers working
with HTML documents. You can find complete cover-
age in JavaScript: The Definitive Guide.

Get JavaScript Pocket Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.