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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

getElementById(id) Returns the element with id equal to the string id or null if it does<br />

not exist. Some implementations may also find objects related to tags with the name<br />

attribute set, but this should not be assumed. (IE5+, MOZ/N6+, DOM1)<br />

getElementsByName(name) Retrieves a collection of elements with name attributes<br />

equal to string name. In some browsers you will also find tags with id values set to<br />

name, however, given that tags should not share id values, this result should not be<br />

assumed. <strong>The</strong> method is meant to support form fields and other HTML elements that<br />

could share name attribute values under older HTML versions. (IE5+, MOZ/N6+,<br />

DOM1 Core)<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)<br />

getSelection() Returns any text currently selected by the user. (N4+)<br />

isSupported(feature [, version]) Returns a Boolean indicating whether feature and<br />

version given in the argument strings are supported. (MOZ/N6+, DOM2)<br />

open() Opens the document for writing, clearing it first if the document has content.<br />

Using this method is typically unnecessary. Internet Explorer implements a more<br />

complicated version of this method. (IE3+, MOZ, N2+, DOM1)<br />

open([mimeType [,name] [, features] [, replace]]) Opens the document for writing.<br />

Using this method is usually unnecessary and when used it generally does not have<br />

parameters. However, when used the mimeType parameter is a string that specifies<br />

the type of data that will be written, name indicates the new name for the document<br />

(e.g., for link targets), features is a string indicating the window-like features the<br />

document should have, and replace is an optional Boolean that when true replaces the<br />

document in the browser‘s history rather than creating a new entry. See MSDN for<br />

complete details. (IE3+)<br />

queryCommandEnabled, queryCommandIndeterm, queryCommandState,<br />

queryCommandSupported, queryCommandValue <strong>The</strong>se methods are related to the<br />

execCommand() method in Internet Explorer, which manipulates the MSHTML editor<br />

control. <strong>The</strong>se methods indicate whether a command is allowed, enabled, and what its<br />

currents status is. See Microsoft documentation at MSDN for details on this very<br />

proprietary technology. (IE4+)<br />

recalc([forceAll]) Forces reevaluation of dynamic properties in the document. If<br />

forceAll is true, then all dynamic properties are reevaluated (not just those that have<br />

changed). (IE5+)<br />

releaseEvents(eventMask) Instructs object to stop capturing the events given in the<br />

bitmask eventMask. Only for the Netscape style of event capture. (N4+)<br />

routeEvent(event) Passes the Event instance event along normally down the<br />

hierarchy. Used to decline to handle an event. Only for the Netscape style of event<br />

capture. (N4+)<br />

selection <strong>Reference</strong> to the selection object containing information about the currently<br />

selected objects in the document. (IE4+)<br />

write(str1 [, str2, ...]) Writes the text arguments to the document. (IE3+, MOZ, N2+,<br />

DOM1)<br />

writeln(str1 [, str2, ...]) Writes the text arguments to the document followed by a<br />

newline at the end of the output. (IE3+, MOZ, N2+, DOM1)<br />

Support<br />

Supported in all major browsers: IE3+ (JScript 1.0+), MOZ, N2+ (<strong>JavaScript</strong> 1.0+), DOM.<br />

dt, HTMLElement (Document Object)<br />

This object corresponds to a (term definition in a definition list) tag in the document.<br />

Access to this object is achieved through standard DOM methods like<br />

document.getElementById().<br />

Properties<br />

This object has the following property, in addition to those in the Generic HTML Element<br />

object found at the beginning of this section:<br />

noWrap Boolean indicating whether the browser should not word wrap the item. (IE4+)

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

Saved successfully!

Ooh no, something went wrong!