The methods and properties in this section are implemented for the document object. Methods and properties already covered in the previous section are not repeated again.
B.2.1. Methods
Method
Description
clear()
Empties the document
close()
Ends the write access to the document
createAttribute(attribute)
Creates an attribute with the given name
createDocumentFragment()
Creates a document fragment
createElement(name)
Creates an element with the given tag name
createTextNode(text)
Creates a text node with the given text
getElementById(id)
Returns the element with the given ID
getElementsByName(name)
Returns all elements with the given name
open(mime, replace)
Opens the document for write access, sets the MIME type, and if the optional replace parameter is true, replaces the old contents (otherwise, appends data)
write(text)
Writes data to the document
writeln(text)
Writes data and a linefeed (\r\n) to the document
B.2.2. Properties
Property
Description
alinkColor
Color for active links
anchors[]
List of all anchors in the document
applets[]
List of all Java applets in the document
bgColor
Background color of the document
body
Body portion of the document
compatMode
Whether the rendering engine uses a compatibility mode for older content
cookie
Cookies the document can access
documentElement
DOM node for the document
domain
Domain of the document
embeds[]
List of all embedded objects
fgColor
Foreground color of the document
forms[]
List of all forms in the document
images[]
List of all images in the document
lastModified
Date of last modification of the document
linkColor
Color for links
links[]
List of all links in the document
location
URL information about the document
referrer
Document the user came from to the current document