632 Part IV: Appendixes
Method
Shorthand
Description
getElementById(
id [,startNode,deepSearch]
)
None
Returns a single DOM element that matches the id
passed as a string; otherwise a null value is
returned. A
startNode
can be passed to indicate
where the search begins from; otherwise the document is assumed. The Boolean parameter deepSearch
can be set to
true
to perform a
brute force search of
id
attribute values that
may be useful when addressing XML trees as commonly found in Ajax response packets.
getElementsById(
id [,startNode,deepSearch]
) $id()
Returns a single DOM element or list of DOM elements that match the
id
(s) passed as strings.
A
startNode
can be passed to indicate where
the search begins from; otherwise the document is assumed. The Boolean parameter
deepSearch
can be set to true to perform a brute force search of
id
attribute values that may be useful when
addressing XML trees as commonly found in Ajax response packets.
getElementsByClassName(
className [,startNode]
) $class()
Returns a list of all the DOM elements with the specified class name. More qualified searches, such as for the stem of a class name, should use the
getElementsBySelector()
method
instead.
getElementsBySelector(
selector [,startNode]
) $selector()
Finds all the DOM elements matching the selector
string passed starting from the
startNode
or the document root if not specified.
The
selector
string should be a string that is a
well-formed CSS2 selector rule.
insertAfter(
parentNode,nodeToInsert,insertPoint
)
None
Inserts the DOM node specified by
nodeToInsert
after the node specified by
insertPoint
. The
parentNode
this operates on must be passed for
reference.
T
ABLE
C-13
Useful DOM Methods