JavaScript Tutorial: DOM own properties
and methods
[this page | pdf | back links]
The JavaScript
DOM (document object) supports
the following (own) properties and methods:
Properties:
Property
|
Description
|
More
|
activeElement
|
Returns the element
that currently has focus
|
Here
|
anchors
|
Returns collection of all <a> elements that
have a name
attribute
|
Here
|
applets
|
Returns collection of all <applet>
elements that have a name
attribute
|
Here
|
baseURI
|
Returns absolute base URI
|
Here
|
body
|
Returns the <body> element
|
Here
|
cookie
|
Returns all name/value cookie pairs
|
Here
|
characterSet
|
Returns
character encoding
|
Here
|
charset
|
Depreciated
(use characterSet
instead). Returns character encoding
|
Here
|
doctype
|
Returns document type
|
Here
|
documentElement
|
Returns main document element of the document (i.e. its <html>
element)
|
Here
|
documentMode
|
Returns mode used by browser to render document
|
Here
|
domain
|
Returns domain name of server
|
Here
|
domConfig
|
Obsolete. Returns DOM configuration
|
Here
|
embeds
|
Returns collection of all <embed>
elements
|
Here
|
forms
|
Returns collection of
all <form> elements
|
Here
|
head
|
Returns the <head> element
|
Here
|
images
|
Returns collection of
all <img> elements
|
Here
|
implementation
|
Returns DOMImplementation object handling document
|
Here
|
inputEncoding
|
Returns encoding (character set) used for document
|
Here
|
lastModified
|
Returns date and time document last modified
|
Here
|
links
|
Returns collection of all <a> and <area>
elements that have a href
attribute
|
Here
|
readyState
|
Returns load status of the document
|
Here
|
referrer
|
Returns URL of
the document that loaded the current document
|
Here
|
scripts
|
Returns collection of
all <script> elements
|
Here
|
strictErrorChecking
|
Sets
/ returns whether to enforce strict error checking
|
Here
|
title
|
Sets / returns document <title>
|
Here
|
URL
|
Returns full URL
|
Here
|
Methods:
Method
|
Description
|
More
|
addEventListener()
|
Attaches an event
handler
|
Here
|
adoptNode()
|
Adopts a node from
another document
|
Here
|
close()
|
Closes output stream previously opened using open()
|
Here
|
createAttribute()
|
Creates
an attribute node
|
Here
|
createComment()
|
Creates a comment node
|
Here
|
createDocumentFragment()
|
Creates an empty DocumentFragment node
|
Here
|
createElement()
|
Creates an element node
|
Here
|
createTextNode()
|
Creates a text node
|
Here
|
getElementById()
|
Returns element with specified id attribute
|
Here
|
getElementsByClassName()
|
Returns NodeList containing all elements with specified class attribute
|
Here
|
getElementsByName()
|
Returns NodeList
containing all elements with specified name attribute
|
Here
|
getElementsByTagName()
|
Returns NodeList
containing all elements with specified tag name (i.e.
element type)
|
Here
|
hasFocus()
|
Returns true if document has focus,
otherwise returns false
|
Here
|
importNode()
|
Imports
node from another document
|
Here
|
normalize()
|
Removes empty text
nodes and joins adjacent notes
|
Here
|
normalizeDocument()
|
Removes empty text
nodes and joins adjacent notes
|
Here
|
open()
|
Opens
an HTML output stream (into which output from write() or writeln()
can go)
|
Here
|
querySelector()
|
Returns first (child) element that matches specified CSSSelector
|
Here
|
querySelectorAll()
|
Returns a NodeList (collection) containing all (child) elements
that match specified CSSSelector(s)
|
Here
|
removeEventListener()
|
Detaches (removes) an
event handler
|
Here
|
renameNode()
|
Renames
specified node
|
Here
|
write()
|
Writes HTML (which can include JavaScript code) to the document
|
Here
|
writeln()
|
As
per write() except that it
adds a new line character after each statement
|
Here
|
Further comments:
The document object also supports some
generic properties
and methods that can be used on all HTML elements / nodes, even though
several of them have no natural meaning when applied to the document object.
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)