Categories: All Free JavaScripts/ Applets Tutorials References

JavaScript Kit > DOM Reference > Here

DOM Document Object properties

Last updated: Februrary 27th, 2006

Document Object properties

Properties Description
body References the body element of the page. From there, you can then access other nodes contained within the body.
body.offsetWidth, body.offsetHeight Returns the width and height of the entire document, respectively.
compatMode Returns the compatibility mode of the current document, specifically, whether the page is rendered in Quirks or Stricts mode. The two possible values returned are "BackCompat" for Quirks and "CSS1Compat" for Strict. Useful for determining the doctype setting of the page and executing different code accordingly.

Example(s):

if (document.compatMode=="CSS1Compat")
// execute code for page with a valid doctype

doctype Read-only property that returns the Document Type Definition (DTD) of the current document, or null if the page doesn't contain a DTD. Not supported in IE as of IE6.
documentElement References the root element of the document, in the case of HTML documents, the html element. This read only property is useful for accessing all elements on the page, such as the HEAD.

Example(s):

entiredoc = document.documentElement;
var docnodes=entiredoc.childNodes
for (i=0; i<docnodes.length; i++)
alert(docnodes[i].tagName)

domain Gets/sets the domain of the current document. Useful in cross domain scripting when one domain is to communicate with another.

Example(s):

document.domain="javascriptkit.com"

implementation Returns the DOM implementation of the current document.
ownerDocument Returns a reference to the document object that contains the current element/node.

var ownerdoc=document.getElementById("adiv").ownerDocument

readyState IE exclusive property that specifies the loading status of the document. It returns one of the below 4 values:
1) uninitialized- The document hasn't started loading yet.
2) loading- The document is loading.
3) interactive- The document has loaded enough whereby user can interact with it.
4) complete- The document has fully loaded.
styleSheets[] An array referencing all stylesheet objects on the page, whether they are defined using the <style> or <link> tag.
title Specifies the title of the document. Read/write in modern browsers.
URL A string that specifies the complete URL of the document.

Note: See also JavaScript document object.

Sponsored By

DD CSS Library
Free CSS menus and codes to give your site a visual boost.

Daniweb JavaScript Community

DOM Window
DOM Document
DOM Element
DOM Event
DOM Style
DOM Table
Miscellaneous

CopyRight © 1998-2008 JavaScript Kit. NO PART may be reproduced without author's permission.