HTML and CSS Reference
In-Depth Information
JavaScript Element
Description
focus()
Gives focus to the document and fires
onfocus
handler
getElementById(
id
)
Returns the element with
id
(or
name
) that is equal to
id
getElementsByClass
Name(
class
)
Returns an array of elements belonging to
class
getElementsByName(
name
)
Gets a collection of elements with
id
(or
name
) that is equal to
name
getElementsByTagName
(
tagname
)
Gets a collection of elements corresponding to
tagname
getElementsByTagNameNS
(
namespace
,
local
)
Returns an array of elements belonging to
namespace
with the local tag name
local
getSelection()
Returns the selected text from the document
hasAttributes()
Returns a Boolean showing if any attributes are defined for the node
hasChildNodes()
Returns a Boolean showing if the node has children
hasFocus()
Returns a Boolean value indicating whether the document has the keyboard focus
importNode(
node
,
deep
)
Passes
node
defined in another document where if
deep
is true, all of the descen-
dant nodes are also passed
insertBefore(
newChild, refChild
)
Inserts the node
newChild
in front of
refChild
in the
childNodes
[ ]list of
refChild
's
parent node
isSupported(
feature
[ ,
version
])
Returns a Boolean showing which feature and version identified in the arguments is
supported
normalize()
Merges adjacent text nodes in the subtree rooted at this element
open()
Opens the document stream
queryCommandSupported(
id
)
Returns true if the browser supports the
id
command
querySelector(
selectors
)
Returns the first element in the document that matches the CSS
selectors
querySelectorAll(
selectors
)
Returns all of the elements in the document that match the CSS
selectors
recalc([
forceAll
])
If
forceAll
is
true
, all dynamic properties are reevaluated
removeChild(
oldChild
)
Removes
oldChild
from the node's children and returns a reference to the
removed node
removeEventListener (
event
,
handler
,
direction
)
Removes the function
handler
for the
event
in the
direction
phase
replaceChild(
newChild,
oldChild
)
Replaces the node's child node
oldChild
with the node
newChild
setActive()
Sets the document as the current element but does not give it focus
write()
Writes to the document window
writeln()
Writes to the document window on a single line (used only with preformatted text)
DocumentFragment
A portion of a document tree
Methods
querySelector(
selectors
)
Returns the first element in the document fragment that matches the
CSS
selectors
querySelectorAll(
selectors
)
Returns all of the elements in the document fragment that match the
CSS
selectors
DocumentType
The DOCTYPE declaration of the document
Properties
name
The name of the document type
publicID
The public identifier of the DTD
systemID
The system identifier of the DTD