Methods

This section describes the methods supported by Document Object Model (DOM)  objects associated with HTML elements and supporting objects.

In this section

TopicDescription

abort

The abort method terminates a pending send.

add

Adds an element to the areas, controlRange, or options collection.

addRange

Adds a Range to the current selection.

alert

Displays a dialog box containing an application-defined message.

This method is not supported for Windows Store apps using JavaScript.

append

Adds or appends key/value pairs of data to a FormData object for use with XMLHttpRequest.

applyElement

Makes the element either a child or parent of another element.

blur

Causes the element to lose focus and fires the onblur event.

checkValidity

Returns whether a form will validate when it is submitted, without having to submit it.

ChooseColorDlg

Opens the system color-selection dialog box.

clear (selection)

Clears the contents of the selection.

clearAttributes

Removes all attributes and values from the object.

clearData

Removes one or more data formats from the clipboard through the dataTransfer object. For the clipboardData object, this method clears all formats.

clearInterval

Cancels the interval previously started using the setInterval method.

clearTimeout

Cancels a time-out that was set with the setTimeout method.

click

Simulates a click by causing the onclick event to fire.

close

Closes the current browser window or HTML Application (HTA).

Closes the app without prompting the user. To the user, it appears as though the app has crashed.

close (document)

Closes an output stream and forces the sent data to display.

collapse

Replaces the current selection with an empty selection (or a caret) at the given offset.

collapseToEnd

Collapses or sets the insertion point or caret at the end of a selection object.

collapseToStart

Collapses, or sets the insertion point or caret at the beginning of a selection object.

componentFromPoint

Returns the component located at the specified coordinates via certain events.

confirm

Displays a confirmation dialog box that contains an optional message as well as OK and Cancel buttons.

This method is not supported for Windows Store apps using JavaScript.

contains

Checks whether the given element is contained within the object.

create (image)

Creates a new img element of the specified width and height. This method cannot be called directly. See Image object.

create (option)

Initializes a new option element. This method cannot be called directly. See Option object.

createCaption

Creates an empty caption element in the table.

createPopup

Note   createPopup is no longer supported. Starting with Internet Explorer 11, use a div, iframe, or other element with a relatively high z-index value. For info, see Compatibility changes.

Creates a popup window object.

createTBody

Creates an empty tBody element in the table.

createTFoot

Creates an empty tFoot element in the table.

createTHead

Creates an empty tHead element in the table.

deleteCaption

Deletes the caption element and its contents from the table.

deleteCell

Removes the specified cell (td) from the table row, as well as from the cells collection.

deleteFromDocument

Deletes the selected nodes from a document.

deleteRow

Removes the specified row (tr) from the element and from the rows collection.

deleteTFoot

Deletes the tFoot element and its contents from the table.

deleteTHead

Deletes the tHead element and its contents from the table.

doScroll

Note   doScroll is no longer supported. Starting with IE11, use scrollLeft or scrollTop. For info, see Compatibility changes.

Simulates a click on a scroll bar component.

dragDrop

Initiates a drag event.

empty

Cancels the current selection, sets the selection type to none, and sets the item property to null.

firstPage

Displays the first page of records in the data set to which the table is bound.

focus

Causes the element to receive the focus and executes the code specified by the onfocus event.

getAttribute

Retrieves the value of the specified attribute.

getAttribute (userProfile)

Obsolete. Returns the value of the named attribute from the userProfile object.

This method is not supported for Windows Store apps using JavaScript.

getBoundingClientRect

Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

getCharset

Gets a Variant that specifies the character set of a given font.

getClientRects

Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

getData

Gets the data in the specified format from the clipboard through the dataTransfer object or the clipboardData object.

getElementsByClassName

Gets a collection of objects that are based on the value of the class attribute.

getElementsByTagName

Retrieves a collection of objects based on the specified element name.

getRangeAt

Returns a specified Range from a selection. The Range is specified by an index and cannot be greater than the number that is returned by rangeCount.

getSelection

Returns an object that represents the current selection of the document.

hasAttributes

Determines whether one or more attributes exist for the object.

hasFocus

Gets a value indicating whether the object currently has focus.

hide

Closes the pop-up window.

This method is not supported for Windows Store apps using JavaScript.

insertCell

Creates a new cell in the table row (tr), and adds the cell to the cells collection.

insertRow

Creates a new row (tr) in the table, and adds the row to the rows collection.

item

Retrieves an object from various collections, including the all collection.

item (Areas)

Retrieves an object from an areas collection.

item (attributes)

Retrieves an attribute for an element from an attributes collection.

item (BehaviorUrns)

Retrieves an object from the behaviorUrns collection.

Item (BlockFormats, Fonts)

Retrieves a string that specifies the name of a block format tag.

item (DocumentCompatibleInfoCollection)

Retrieves an object from a documentCompatibleInfoCollection collection.

item (Form, Elements)

Retrieves a form object or an object from an elements collection.

item (Options, Select)

Retrieves a select object or an object from an options collection.

item (TextRectangle)

Retrieves an object from a TextRectangle collection.

lastPage

Displays the last page of records in the data set to which the table is bound.

mergeAttributes

Copies all read/write attributes to the specified element.

moveBy

Moves the screen position of the window by the specified x and y offset values.

moveRow

Moves a table row to a new position.

moveTo

Moves the screen position of the upper-left corner of the window to the specified x and y position.

msMatchesSelector

Determines whether an object matches the specified selector.

namedItem

Retrieves an object or a collection from a specified collection.

namedItem (Areas)

Retrieves an object from an areas collection.

namedItem (Form, elements)

Retrieves a form object or an object from an elements collection.

namedItem (Options, Select)

Retrieves a select object or an object from an options collection.

open

Opens a new window and loads the document specified by a given URL.

Navigates the app window to the specified location.

open (document)

Opens a document for writing.

Note  Can also be used to behave like the open method of the window object if the url, name, features, and replace parameters are specified using the following syntax:

var retval = document.open(url, name, features, replace);

Refer to the window.open reference for usage.

previousPage

Displays the previous page of records in the data set to which the table is bound.

remove

Removes an element from the collection.

removeAllRanges

Removes all ranges from a selection.

removeAttribute

Removes an attribute from an object.

removeRange

Removes a range from a selection.

replaceAdjacentText

Replaces the text adjacent to the element.

reset

Simulates a mouse click on a reset button for the calling form.

resizeBy

Changes the current size of the window by the specified x- and y-offset.

resizeTo

Sets the size of the window to the specified width and height values.

scroll

Causes the window to scroll to the specified x- and y-offset at the upper-left corner of the window.

scrollBy

Causes the window to scroll relative to the current scrolled position by the specified x- and y-pixel offset.

scrollTo

Scrolls the window to the specified x- and y-offset.

select

Highlights the input area of a form element.

selectAllChildren

Replaces the current selection with all the contents of the given node.

setActive

Sets the object as active without setting focus to the object.

setAttribute

Sets the value of the specified attribute.

setCustomValidity

Sets a custom error message that is displayed when a form is submitted.

setInterval

Evaluates an expression each time a specified number of milliseconds has elapsed.

setSelectionRange

Sets the start and end positions of a selection in a text field.

setTimeout

Evaluates an expression after a specified number of milliseconds has elapsed.

show

Displays a pop-up window on the screen.

This method is not supported for Windows Store apps using JavaScript.

showModalDialog

Creates a modal dialog box that displays the specified HTML document.

showModelessDialog

Creates a modeless dialog box that displays the specified HTML document.

stepDown

Decrements a range input control's value by the value given by the Step attribute.

stepUp

Increments a range input control's value by the value given by the Step attribute.

submit

Submits the form.

tags

Retrieves a collection of objects that have the specified HTML tag name.

toStaticHTML

Removes dynamic HTML elements and attributes from an HTML fragment.

updateSettings

Allows updating the print settings for the page.

write

Writes one or more HTML expressions to a document in the specified window.

writeln

Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.

 

 

 

Show:
© 2014 Microsoft