11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Document (Document Object)<br />

<strong>The</strong> Document provides access to the contents of the HTML document currently loaded. In<br />

early browsers, this was primarily a browser object because there was no standard governing<br />

its structure. With the rise of the DOM, this object has become standardized, although modern<br />

browsers continue to provide a multitude of proprietary features.<br />

HTML elements in the page are represented as objects under the Document. Each such<br />

element object has properties and methods derived from a variety of sources. <strong>The</strong> most<br />

obvious of these are proprietary browser features, but elements also inherit properties and<br />

methods from the DOM Node interface, the DOM HTMLElement definition, and possibly more<br />

specific DOM objects. While the specific origin of a property is often not particularly important<br />

so long as the property is well supported, the reader should be aware that the structure of each<br />

element object is derived from a variety of sources.<br />

<strong>The</strong> collections contained within the Document are in general read-only, although specific<br />

elements of the collections are often mutable.<br />

Properties<br />

activeElement <strong>Reference</strong> to the object related to the element that currently has focus.<br />

This property is read-only. (IE4+)<br />

alinkColor String containing the color of activated links. (IE3+, MOZ, N2+, DOM0)<br />

anchors[] Collection of Anchor objects in the page (corresponds to ...). <strong>The</strong> collection is read-only, though the individual anchors can be<br />

modified and the DOM can be used to directly add or remove anchors that will<br />

ultimately affect the array‘s contents. (IE3+, MOZ, N2+, DOM1)<br />

applets[] Collection of Applet objects in the page (corresponds to elements).<br />

Like other document collections the individual objects can be manipulated, though the<br />

array itself is read-only. (IE4+, MOZ, N3+, DOM1)<br />

bgColor String containing the background color of the document. (IE3+, MOZ, N2+,<br />

DOM0)<br />

body <strong>Reference</strong> to the or element object of the document. (IE3+,<br />

MOZ/N6+, DOM1)<br />

charset String containing the character set of the document. (IE4+)<br />

characterSet String containing the character set of the document. (MOZ/N6+)<br />

classes[] A Netscape 4–specific collection to access the style properties for CSS<br />

classes. (NS4 only)<br />

compatMode Boolean indicating whether standards-compliant mode is on for the<br />

document. (IE6+)<br />

cookie String holding the cookies the browser has for the domain of the document.<br />

Values set into this property are automatically parsed as cookies by the browser. (IE3+,<br />

MOZ, N2+, DOM1)<br />

defaultCharset Read-only string containing the client‘s default character set. (IE4+)<br />

designMode String specifying whether design mode is on or off. When on, the user<br />

can double-click or otherwise activate an object and edit its HTML. (IE5+, MOZ/N7+)<br />

dir String holding the text direction of text enclosed in the document. (IE5+, MOZ/N6+,<br />

DOM0)<br />

doctype <strong>Reference</strong> to the DocumentType object for the document. (IE6+, MOZ/N6+,<br />

DOM1 Core)<br />

documentElement <strong>Reference</strong> to the root node of the document object hierarchy.<br />

(IE5+, MOZ/N6+, DOM1 Core)<br />

domain String containing the domain name from which the document was fetched.<br />

Can be set to a more general domain (e.g., www.javascriptref.com to<br />

javascriptref.com) in order to work around the same origin policy, but otherwise is not<br />

generally modifiable. (IE4+, MOZ, N3+, DOM1)<br />

embeds[] Collection of all Embed objects in the document (corresponds to <br />

elements). Like other document collections the individual objects can be manipulated,<br />

though the array itself is read-only. (IE4+, MOZ, N3+)<br />

expando Boolean dictating whether instance properties can be added to the object.<br />

(IE4+)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!