11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

fireEvent(handler [, event]) Causes the event handler given by the string handler to<br />

fire. If an Event instance was passed as event, the new event created reflects the<br />

properties of event. (IE5.5+)<br />

focus() Gives focus to the element.<br />

getAdjacentText(where) Returns the string of text corresponding to the text string at<br />

position where, with respect to the current node. <strong>The</strong> where parameter is a string with<br />

the following values:<br />

Value of<br />

where<br />

String Returned<br />

"beforeBegin" Text immediately preceding element‘s opening tag (back to but not<br />

including first element encountered).<br />

"afterBegin" Text immediately following the element‘s opening tag (up to but not<br />

including the first nested element).<br />

"beforeEnd" Text immediately preceding the element‘s closing tag (back to but not<br />

including the closing tag of the last enclosed element).<br />

"afterEnd" Text immediately following element‘s closing tag (up to but not including the<br />

first following tag).<br />

<strong>The</strong>re is no standard DOM method that mimics this behavior. Instead, you must examine the<br />

previousSibling, firstChild, lastChild, or nextSibling (in order corresponding to the values of<br />

where in the preceding table) and extract the string manually from their text node(s). (IE5+)<br />

getAttribute(name) Returns a string containing the value of the attribute specified in<br />

the string name or null if it does not exist. (IE4+, MOZ/N6+, DOM1 Core)<br />

getAttributeNode(name) Returns the attribute node corresponding to the attribute in<br />

the string name. (IE6+, MOZ/N6+, DOM1 Core)<br />

getBoundingClientRect() Retrieves a TextRectangle with properties top, bottom,<br />

left, right indicating the pixel values of the rectangle in which the element‘s content is<br />

enclosed. (IE5+)<br />

getClientRects() Retrieves a collection of TextRectangle objects, which give the pixel<br />

coordinates of all bounding rectangles contained in the element. (IE5+)<br />

getElementsByTagName(tagname) Retrieves a collection of elements corresponding<br />

to the tag given in string tagname. A value of "*" retrieves all tags. (IE5+, MOZ/N6+,<br />

DOM1 Core)<br />

getExpression(propertyName) Retrieves the string giving the dynamic property<br />

expression for the property/attribute named propertyName. (IE5+)<br />

hasAttribute(name) Returns a Boolean indicating if the attribute given in string name<br />

is defined for the node (explicitly or by default). (MOZ/N6+, DOM2 Core)<br />

hasAttributes() Returns a Boolean indicating if any attributes are defined for the node.<br />

(MOZ/N6+, DOM2 Core)<br />

hasChildNodes() Returns a Boolean indicating if the node has children. (IE5+,<br />

MOZ/N6+, DOM1 Core)<br />

insertAdjacentElement(where, element) Inserts the element object given in element<br />

adjacent to the current element in the position given by the string where (IE5+).<strong>The</strong><br />

possible values for where include these:<br />

Value of<br />

where<br />

Effect<br />

"beforeBegin" Inserts immediately before the object.<br />

"afterBegin" Inserts after the start of the object but before all other content.<br />

"beforeEnd" Inserts immediately before the end of the object, after all other content.<br />

"afterEnd" Inserts immediately after the end of the object.<br />

insertAdjacentHTML(where, text) Inserts the HTML given in string text adjacent to<br />

the current element according to the string where. See table under

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!