HOME

DHTML Tutorial
DHTML HOME
DHTML Intro
DHTML CSS
DHTML DOM
DHTML Events

DHTML Examples
DHTML Examples

DHTML DOM
DOM window
DOM navigator
DOM event
DOM collection
DOM document
DOM form
DOM input
DOM select
DOM option
DOM textarea
DOM table
DOM tablerow
DOM tablecell
DOM anchor
DOM image
DOM frameset
DOM frame
DOM iframe

DOM Examples
DOM Examples

Resources
DHTML Books

Please visit our sponsors !

The document object

previous next

The document object represents the HTML document, and gives you access to the HTML elements.


Methods Explanation
appendChild() Append an element to the document as a child
applyElement() Applies one element to another element
attachEvent() Attaches the function to an event, so that the function gets called whenever the event is fired
clear() Clears the document
cloneNode() Makes a copy of the document
close() Closes the document
createDocumentFragment() Creates a new document object
createElement() Creates a new element of the specified tag
createStyleSheet() Creates a style sheet
createTextNode() Creates a text string from the given value
detachEvent() Detaches a function from an event
elementFromPoint() Returns the element at the specified x and y coordinates
execCommand Executes a command
getAdjacentText() Returns the adjacent text character
hasChildNodes() Returns whether or not the node has children
insertAdjacentElement() Inserts an element at the specified location
insertBefore() Inserts an element in the document hierarchy
open() Opens the document
queryCommandEnabled() Returns whether the command can be executed successfully using execCommand
queryCommandIndterm() Returns whether the state of the specified command is determined
queryCommandState() Returns the current state of the command
queryCommandSupported() Returns whether the current command is supported
queryCommandValue() Returns the current value of the given command
recalc() Recalculates all dynamic properties in the current document
releaseCapture() Removes mouse capture from the document
removeChild() Removes a child node from an element
removeNode() Removes the document
replaceAdjacentText() Replaces the adjacent text with the specified text
replaceChild() Replace an existing child element with a new element
replaceNode() Replaces the document with a new element
swapNode() Switches the location between two objects
write() Writes HTML code into the document
writeln() Writes HTML code into the document, followed by a new line character


Properties Explanation
activeElement Returns the object with the keyboard focus
alinkColor Sets or retrieves the color for the document's active links
bgColor Sets or retrieves the background color of the document
body Returns the body object
charset Returns the character set for the document
cookie Sets or retrieves the string value of a cookie
defaultCharset Sets or retrieves the default character set
designMode Switches between browsing mode and editing mode
documentElement Returns the document object
domain Sets or retrieves the security domain for the document
expando Sets or retrieves whether or not arbitrary variables can be created within the document
fgColor Sets or retrieves the foreground text color
fileCreatedDate Returns the date when a file was created
fileModifiedDate Returns the date when a file was last modified
fileSize Returns the size of a file
firstChild Returns a reference to the first child in the childnodes collection
lastChild Returns a reference to the last child in the childnodes collection
lastModified Returns the date when the Web page was last modified
linkColor Sets or retrieves the color of the hyperlinks in the document
location Returns an object that gives you information about the current URL
nextSibling Returns a reference to the next sibling of an object
nodeName Returns the name of node
nodeType Returns the type of a node
nodeValue Sets or retrieves the node value
parentNode Returns the parent node of an object
parentWindow Returns the parent window for the document
previousSibling Returns a reference to the sibling immediately preceding the specified object
protocol Returns the access method of a URL
readyState Returns the current state of the document
referrer Returns the URL of the previous Web page the user visited
selection Returns an object that of the block, text, or object currently selected
title Returns an object that contains the title of the document
uniqueID Returns a unique identifier for the document
URL Sets or retrieves the URL of the document
vlinkColor Sets or retrieves the color for the document's visited links


Collection Explanation
all Returns a collection of all elements in the document
anchors Returns a collection of all the anchor objects in the document
applets Returns a collection of all the applet objects in the document
attributes Returns a collection of attributes of an object
childNodes Returns a collection of the child nodes for the specified object
children Returns a collection of the direct descendants of an object
embeds Returns a collection of all the embed objects in the document
forms Returns a collection of all the form objects in the document
frames Returns a collection of all window objects that exist on a Web page
images Returns a collection of all img objects in the document
links Returns a collection of all the anchor objects that specify the href attribute and all the area objects
scripts Returns a collection of all the script objects in the document
stylesheets Returns a collection of all the styleSheet objects in the document


previous next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

ASPHits
Active Server Pages Resource Web Site


Your own Web Site?

Read W3Schools
Hosting Tutorial



ASP Hosting
ASP.net Hosting
Web Hosting



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

Books Online

Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search