HTML and CSS Reference
In-Depth Information
JavaScript Element
Description
getClientRects()
Returns an array of
ClientRect
objects bounding the element
getElementsByClassName
(
classnames
)
Returns an array of descendant elements that belong to
classnames
getElementsByTagName(
name
)
Returns an array of descendant elements that have the tag name
name
getElementsByTagNameNS
(
namespace
,
local
)
Returns an array of descendant elements that have the tag name
local
and belong
to
namespace
hasAttribute(
name
)
Returns true if the element has the attribute
name
hasAttributeNS
(
namespace, local
)
Returns true if the element has the attribute
local
belonging to
namespace
insertAdjacentHTML
(
position
,
text
)
Inserts the HTML markup
text
at the specified
position
relative to the element
querySelector(
selectors
)
Returns the first descendant element that matches the CSS
selectors
querySelectorAll(
selectors
)
Returns all of the descendant elements that match the CSS
selectors
removeAttribute(
name
)
Removes the
name
attribute
removeAttribute
(
namespace, local
)
Removes the
local
attribute belonging to
namespace
scrollIntoView([
top
])
Scrolls the element into view where
top
is an optional property to scroll to the top
of the window
setAttribute(
name
,
value
)
Sets the value of the attribute named
name
to
value
setAttributeNS(
namespace
,
name
,
value
)
Sets the value of the attribute named
name
within the namespace
namespace
to
value
ErrorÆ’
A generic
Error
object created using one of the following constructors:
new Error()
new Error(
message
)
where
message
provides details about the error exception. If no message is
specified, it uses an implementation-defined default string as the value
Properties
message
An error message that provides information about the error
name
A string that specifies the type of error
Methods
toString()
Returns the text string that defines the error
Event
An
Event
object of different events occurring within the Web page and
browser. The object is referenced in IE as
window.event
and in other
browsers as a parameter of the event function.
Properties
altKey
A Boolean indicating whether the Alt key is pressed
bubbles
A Boolean indicating whether the event bubbles
button
The mouse button pressed
cancelable
A Boolean indicating whether the event can be cancelled
cancelBubble
A Boolean that tells the browser to cancel the event from bubbling up the event
model (IE only)
charCode
The Unicode value of the pressed key (similar to IE's keyCode)
clientX
The horizontal mouse coordinate of the event relative to the upper-left corner of the
browser window
clientY
The vertical mouse coordinate of the event relative to the upper-left corner of the
browser window