Methods Reference

Methods Reference



add

Description

Adds an element to the collection.

Before you can add an element to a collection, you must create it first by using the createElement method.

Syntax

object.add(element [, index])

ParameterDescription
element Element object to add.
index Optional. Number specifying the position within the collection to place the element. If no value is given, the method places the element at the end of the collection.

Return Value

No return value.

Remarks

For the areas object, this method can only be used on the object after the page has been loaded. If the method is applied "inline," a run-time error will occur.

Applies To

areas, options

See Also

remove


addChannel

Description

Presents a dialog box allowing the user to add the channel specified or change its usage if it is already installed.

Syntax

object.addChannel(urlToCDF)

ParameterDescription
urlToCDF Required. Specifies the URL of a Channel Definition Format (CDF) file to be installed.

Remarks

Important Note: This function is only intended for use by publishers shipping Active Channels that are pre-installed with Internet Explorer 4.0. It is included in this documentation for completeness.

Applies To

external


addImport

Description

Adds a style sheet to the imports collection for the given style sheet.

Syntax

integer = stylesheet.addImport(url [, index])

ParameterDescription
url String specifying the location of the source file for the style sheet.
index Optional. Integer specifying the requested position of the style sheet in the collection. If this value is not given, the style sheet is added to the end of the collection.

Return Value

Returns an integer index value specifying the position of the imported style sheet in the imports collection.

Remarks

The index is a zero-based index value.

Applies To

styleSheet


addReadRequest

Description

Adds an entry to the read-requests queue.

Syntax

navigator.userProfile.addReadRequest(attributeName [, isRequired], success)

ParameterDescription
attributeName One of the standard vCard names; otherwise, the request is ignored and nothing is added to the read-requests queue.
isRequired Optional. Currently, Internet Explorer ignores this parameter.
success Returns TRUE if the request has been added to the queue successfully, or FALSE otherwise. This could mean that either the attribute name was not recognized or the attribute had already appeared in the request queue.

Applies To

userProfile


addRule

Description

Creates a new style rule for the styleSheet object and returns the index into the Rules collection. Rules can be added to a disabled styleSheet, but they will not apply to the document unless the styleSheet has been enabled.

Syntax

integer = object.addRule(selector, style [, index])

ParameterDescription
selector String specifying the selector for the new rule. Single contextual selectors are valid. For example, "DIV P B" is a valid contextual selector.
style String specifying the style assignments for this style rule. This style takes the same form as an inline style specification. For example, "color:blue" is a valid style parameter.
index Integer that specifies where in the Rules collection to add the new style rule. This is an optional parameter. If an index is not provided, the rule will be added to the end of the Rules collection by default.

Return Value

The return value is reserved; do not use.

Remarks

The following example adds a rule to the beginning of the Rules collection for all text in BOLD that appears in a <DIV> <P> tag to be set to the color blue.

var new_rule;
new_rule = styleSheets[0].addRule("DIV P B", "color:blue", 0);

Remarks

NOTE: When manipulating stylesheets through the Object Model, you will not be able to addRule() where the style is "position" to an element which doesn't already have positioning set for it. You can, however, add a rule to the object to make it "position:absolute" if the object has already been set to "position:relative" (and vice versa).

Applies To

styleSheet


alert

Description

Displays an Alert dialog box with a message and an OK button.

Syntax

object.alert([message])

ParameterDescription
message Optional. (String) String to display.

Return Value

No return value.

Remarks

The title bar of the Alert dialog box cannot be changed.

Applies To

window


assign

Description

Sets the current location to url. This method loads the given document specified by url if it exists.

Syntax

object.assign(url)

ParameterDescription
url String specifying the URL of the document to assign.

Return Value

No return value.

Applies To

location


back

Description

Loads the previous URL in the History list.

Syntax

object.back( )

Return Value

No return value.

Remarks

This method performs the same action as a user choosing the Back button in the browser. The back method is the same as history.go(-1). Trying to go past the beginning of the history does not generate an error. Instead, you are left at the current page.

Applies To

history

See Also

forward, go


blur

Description

Causes an object to lose focus and fires the onblur event.

Syntax

object.blur( )

Return Value

No return value.

Applies To

A, APPLET, AREA, BODY, BUTTON, CAPTION, DIV, EMBED, FIELDSET, FRAME, FRAMESET, HR, IFRAME, IMG, INPUT, MARQUEE, OBJECT, SELECT, SPAN, TABLE, TD, TEXTAREA, TR, window


clear

Description

Clears the contents of the selection.

Syntax

object.clear( )

Return Value

No return value.

Applies To

selection


clear

Description

Clears the current document.

Syntax

object.clear( )

Return Value

No return value.

Applies To

document


clearInterval

Description

Cancels the interval previously started using the setInterval method.

Syntax

object.clearInterval(intervalID)

ParameterDescription
intervalID Integer specifying which interval to cancel. This value must have been previously returned by the setInterval method.

Return Value

No return value.

Applies To

window


clearRequest

Description

Clears the compound request, cleaning the slate for building a new request for profile access.

Syntax

navigator.userProfile.clearRequest

Return Value

No return value.

Applies To

userProfile


clearTimeout

Description

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

Syntax

object.clearTimeout(timeoutID)

ParameterDescription
timeoutID (Long) Time-out setting that was returned by a previous call to the setTimeout method.

Return Value

No return value.

Applies To

window


click

Description

Simulates a click by causing the onclick event to fire.

Syntax

object.click( )

Return Value

No return value.

Applies To

A, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, H1, H2, H3, H4, H5, H6, HR, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP


close

Description

Closes the current browser window.

Syntax

object.close( )

Return Value

No return value.

Applies To

window


close

Description

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

Syntax

object.close( )

Return Value

No return value.

Applies To

document


collapse

Description

Moves the insertion point to the beginning or the end of the current range.

Syntax

object.collapse([start])

ParameterDescription
start Optional. (Boolean) False moves the insertion point to the end of the text range. True (default) moves the insertion point to the beginning of the text range.

Return Value

No return value.

Remarks

This feature might not be available on non-Win32® platforms. See article Q172976 in the Microsoft® Knowledge Base for the latest information on Internet Explorer cross-platform compatibility.

Applies To

TextRange

See Also

expand


compareEndPoints

Description

Compares the two end points and returns -1, 0, or 1 for less than, equal to, or greater than, respectively.

Syntax

object.compareEndPoints(type, range)

ParameterDescription
type String that describes the end point to compare. Can be one of these values:
StartToEnd
StartToStart
EndToStart
EndToEnd
range Text range object specifying the range from which the source end point is to be taken.

Return Value

Returns the result of the comparison.

Remarks

This feature might not be available on non-Win32 platforms. See article Q172976 in the Microsoft Knowledge Base for the latest information on Internet Explorer cross-platform compatibility.

Applies To

TextRange


confirm

Description

Displays a Confirm dialog box with the specified message, and OK and Cancel buttons.

Syntax

object.confirm([message])

ParameterDescription
message Optional. (String) String to display.

Return Value

Returns TRUE if the user chooses OK, or FALSE if the user chooses Cancel.

Remarks

You have no control over the dialog box title.

Applies To

window


contains

Description

Checks whether the given element is contained within the current element.

Syntax

Boolean = object.contains(element)

ParameterDescription
element Element object specifying the element to check.

Return Value

Returns TRUE if the element is contained, or FALSE otherwise.

Applies To

A, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML, I, IFRAME, IMG, INPUT, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, META, NEXTID, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XMP


createCaption

Description

Creates an empty CAPTION element in the TABLE. If a CAPTION already exists, createCaption() returns the existing element, otherwise, it returns a pointer to the element created.

Syntax

object.createCaption()

Return Value

Returns the CAPTION element object. If the method fails, it returns null.

Remarks

The following example creates a caption,


myCaption = document.all.myTable.createCaption()

Applies To

table

See Also

createTFoot, createTHead, deleteTHead, deleteTFoot, deleteCaption


createElement

Description

Creates an instance of the element object for the specified tag. Only new IMG and OPTION elements can be created. Before they can be used, new objects must be explicitly added to their respective collections.

Syntax

element = object.createElement(tag)

ParameterDescription
tag (String) Tag specifier.

Return Value

Returns an element object.

Applies To

document

See Also

add


createRange

Description

Creates a text range object from the current selection.

Syntax

object.createRange( )

Applies To

selection


createStyleSheet

Description

Creates a style sheet.

Syntax

object.createStyleSheet(url, index)

ParameterDescription
url Optional string that indicates how the style sheet will be added to the document. If a URL is not supplied (default), the style information supplied in the URL will be added as a <style> object. If a URL is specified, the style information will be added as a <link> object.
index Optional integer indicating where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style at the end of the collection.

Return Value

Returns a styleSheet object.

Applies To

document


createTextRange

Description

Creates a text range object for the given object. You use a text range to examine and modify the text within an object.

Syntax

TextRange = object.createTextRange( )

Return Value

Returns a text range object if successful, or NULL otherwise.

Examples

The following JScript example creates a text range for the document, then uses the range to display all text and HTML tags in the document.

var rng = document.body.createTextRange( );
if (rng!=null) {
    alert(rng.htmlText);
}

The following JScript example creates a text range for the first BUTTON element in the document, then uses the text range to change the text in the button.

var coll = document.all.tags("BUTTON");
if (coll!=null && coll.length>0) {
    var rng = coll[0].createTextRange();
    rng.text = "Clicked";
}

Applies To

BODY, BUTTON, INPUT (text type only), TEXTAREA

See Also

TextRange


createTHead

Description

Creates an empty THEAD element in the TABLE. If a THEAD already exists, createTHead returns the existing element, otherwise, it returns a pointer to the element created.

Syntax

object.createTHead()

Return Value

Returns the THead element object. If the method fails, it returns null.

Remarks

The following example creates a THEAD,


myTHead = document.all.myTable.createTHead() 

Applies To

table

See Also

createTFoot, createCaption, deleteTHead, deleteTFoot, deleteCaption


createTFoot

Description

Creates an empty TFOOT element in the TABLE. If a TFOOT already exists for the TABLE, createTFoot returns the existing element, otherwise, it returns a pointer to the element created.

Syntax

object.createTFoot()

Return Value

Returns the THead element object. If the method fails, it returns null.

Remarks

The following example creates a TFOOT,


myTFoot = document.all.myTable.createTFoot()

Applies To

table

See Also

createTHead, createCaption, deleteTHead, deleteTFoot, deleteCaption


deleteCaption

Description

Deletes the Caption element and its contents from the TABLE.

Syntax

object.deleteCaption()

Return Value

No return value.

Remarks

The following example deletes the caption,


document.all.myTable.deleteCaption()

Applies To

table

See Also

createTFoot, createTHead, createCaption, deleteTFoot, deleteTHead


deleteCell

Description

Deletes the specified cell (TD) in the table row and removes the cell from the cells collection. You can specify a cellIndex for the cell to be deleted from the TD, or without a cellIndex, the last cell in the cells collection will be deleted.

Syntax

object.deleteCell(index)

Return Value

No return value. Index specifies which element in the cells collection to remove.

Remarks

The following example deletes the last cell in the first row of the table


document.all.myTable.rows[0].deleteCell() 

Applies To

TR

See Also

insertCell, deleteRow


deleteRow

Description

Deletes the specified row (TR) in the table and removes the row from the rows collection. Deleting a row from a TFOOT, TBODY, or THEAD also removes the row from the rows collection for the TABLE. Deleting a row in the TABLE, removes a row from the rows collection for the TBODY. However, when specifying the index for the row to be deleted, you must specify the sectionRowIndex if the row is being deleted from a TBODY, TFOOT or THEAD. You must specify the rowIndex if the row is being deleted from the TABLE.

Syntax

object.deleteRow(index)

Return Value

No return value Index specifies which element in the rows collection to remove.

Remarks

The following example deletes the specified row (TR) in the table,


myNewRow = document.all.myTable.deleteRow()

Applies To

table, TBODY, TFOOT, THEAD

See Also

rows, rowIndex, sectionRowIndex, insertRow

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.