
Creates a new cell in the table row and adds the cell to the cells collection.
object.insertCell(index)
Returns the TD element object. If the method fails, it returns null. Index is optional. Default value is "-1" which appends the TD to the end of the cells collection.
The following example adds a cell to the end of the TR,
myNewCell = document.all.myTable.rows[0].insertCell()
deleteCell, InsertRow
Creates a new row (TR) in the table and adds the row to the rows collection. Inserting a row in a TFOOT, TBODY, or THEAD also adds a row to the rows collection for the TABLE. Inserting a row in the TABLE, adds a row to the rows collection for the TBODY. If specifying an index, the index should be relative to the rows collection for the element which first contains the TR. For example, insertRow for a TBODY would take an index value relative to the rows collection that is on the TBODY, not the TABLE.
object.insertRow(index)
Returns the TR element object. If the method fails, it returns null. Index is optional. Default value is "-1" which appends the TD to the end of the rows collection.
The following example adds a row to the TABLE,
myNewRow = document.all.myTable.insertRow()
Returns whether the specified range is equal to the current range.
Boolean = object.isEqual(compareRange)
Parameter Description compareRange (TextRange) Range object.
Returns TRUE if equal, FALSE otherwise.
Returns whether the given channel is subscribed to by the client.
Boolean = object.isSubscribed(urlToCDF)
Parameter Description urlToCDF Required. Specifies the URL of a Channel Definition Format (CDF) file to be checked for a subscription.
Returns true if the channel is subscribed to, or false if no subscription exists for that CDF file.
For security purposes, if this method is used in an HTML page that is not in the same secondary domain specified in the urlToCDF, the method will return a scripting error.
Further information is available on Creating Active Channels.
Retrieves an element or a collection from the given collection. The index determines which action to take.
element = object.item(index [, subindex])
Parameter Description index Number or string specifying the element or collection to retrieve. If this parameter is a number, the method returns the element in the collection at the given position, where the first element has value 0, the second has 1, and so on. If this parameter is a string, the method returns a collection of elements, where the value of the name or id property for each element is equal to the string. subindex Optional. Number specifying the position of an element to retrieve. This parameter is used when index is a string. The method uses the string to construct a collection of all elements that have a name or id equal to the string, then retrieves from this collection the element at the position specified by subindex.
Returns an element object or a collection of element objects if successful, or null otherwise.
The following JScript example uses the item method to retrieve each element from the document. In this case, the method parameter is a number, so the elements are retrieved in the order in which they appear in the document.
var coll = document.all; if (coll!=null) { for (i=0; i<coll.length; i++) alert(coll.item(i).tagName); }The following JScript example uses the item method to retrieve a collection of all elements in the document having "Sample" as an id. It then uses item again to retrieve each element from the "Sample" collection.
var coll = document.all.item("Sample"); If (coll != null) { for (i=0; i<coll.length; i++) { alert(coll.item(i).tagName); } }The following JScript example is similar to the previous example, but uses the optional subindex parameter of item to retrieve individual elements.
var coll = document.all.item("Sample") if (coll!=null) { for (i=0; i<coll.length; i++) alert(document.all.item("Sample",i).tagName); }
all, anchors, applets, areas, cells, elements, embeds, filters, forms, frames, images, imports, links, options, plugins, rows, scripts, styleSheets
Returns whether Java is enabled.
Boolean = object.javaEnabled( )
Returns TRUE if Java is enabled, or FALSE otherwise.
Collapses the given text range and moves the empty range by the given number of units.
long = object.move(unit [, count])
Parameter Description unit String specifying the units to move. Can be one of the following:
character Moves one or more characters. word Moves one or more words. A word is a collection of characters terminated by a space or other white-space character. sentence Moves one or more sentences. A sentence is a collection of words terminated by a punctuation character, such as a period. textedit Moves to the start or end of the original range. count Optional. Integer specifying the number of units to move. This can be positive or negative. When omitted, defaults to 1.
Returns the actual number of units moved.
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.
Moves the screen position of the window by the specified x and y offsets relative to its current position.
object.moveBy(x, y)
Parameter Description x (Long) Horizontal scroll offset, in pixels. y (Long) Vertical scroll offset, in pixels.
No return value.
Changes the scope of the range by moving the end position of the range.
long = object.moveEnd(unit [, count])
Parameter Description unit String specifying the units to move. Can be one of the following strings:
character Moves one or more characters. word Moves one or more words. A word is a collection of characters terminated by a space or other white-space character. sentence Moves one or more sentences. A sentence is a collection of words terminated by a punctuation character, such as a period. textedit Moves to the start or end of the original range. count Optional. Integer specifying the number of units to move. This can be positive or negative. When omitted, defaults to 1.
Returns the actual number of units moved.
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.
Changes the scope of the range by moving the start position of the range.
long = object.moveStart(unit [, count])
Parameter Description unit String specifying the units to move. Can be one of the following strings:
character Moves one or more characters. word Moves one or more words. A word is a collection of characters terminated by a space or other white-space character. sentence Moves one or more sentences. A sentence is a collection of words terminated by a punctuation character, such as a period. textedit Moves to the start or end of the original range. count Optional. Integer specifying the number of units to move. This can be positive or negative. When omitted, defaults to 1.
Returns the actual number of units moved.
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.
Moves the screen position of the upper-left corner of the window to the specified x and y pixel position.
object.moveTo(x, y)
Parameter Description x (Long) Horizontal scroll offset, in pixels. y (Long) Vertical scroll offset, in pixels.
No return value.
Moves to a bookmark. Bookmarks are opaque strings that are created with the getBookmark method.
Boolean = object.moveToBookmark( )
Returns TRUE if successful, or FALSE otherwise.
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.
Moves the text range so that the start and end positions of the range encompass the text in the given element.
object.moveToElementText(element)
Parameter Description element Element object.
No return value.
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.
Moves the start and end positions of the text range to the given point. The coordinates of the point must be in pixels and be relative to the upper-left corner of the window. The resulting text range is empty, but can be expanded and moved using methods such as expand and moveEnd.
object.moveToPoint(x, y)
Parameter Description x Integer specifying the x-coordinate, in pixels. y Integer specifying the y-coordinate, in pixels.
No return value.
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.
The following JScript example moves the text range to the same point as the user clicked the mouse, then expands the range and selects the text within the new range.
<SCRIPT FOR=document EVENT=onclick LANGUAGE="JScript"> var rng = document.body.createTextRange(); rng.moveToPoint(window.event.x, window.event.y); rng.expand("word"); rng.select(); </SCRIPT>
Equivalent to the window.location.href property.
object.navigate(URL)
Parameter Description URL (String) URL to be displayed.
No return value.
href property
Allows viewing the next page of records in the data set to which the table is bound.
object.nextPage( )
No return value.
The number of records displayed in the table is determined by the dataPageSize property of the table. The Web author must set the DATAPAGESIZE attribute when designing the page or set the corresponding dataPageSize property at run time for this method to have any effect.
Note The page author does not need to check for boundary conditions.
table
Opens a new window and loads the document given by URL, or a blank document if a URL is not provided.
window = object.open([URL [, name [, features [, replace]]]])
Parameter Description URL String specifying the URL of the document to display. If no URL is specified, a new window with about:blank will be displayed. name Optional. String specifying the name of the window. This name is used for TARGET on a FORM or an A. features Optional. String specifying the window ornaments to display. The following table lists the supported features.
Syntax Description fullscreen={ yes | no | 1 | 0 } Specifies whether to display the browser in a full-screen or normal window. Default is no. Use full-screen mode carefully. Because this mode hides the browser's title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 will also close the new window.
channelmode={ yes | no | 1 | 0 } Specifies whether to display the window in theater mode and show the channel band. toolbar={ yes | no | 1 | 0 } Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available. location= { yes | no | 1 | 0 } Specifies whether to display the input field for entering URLs directly into the browser. directories = { yes | no | 1 | 0 } Specifies whether to add directory buttons. Default is no. status={ yes | no | 1 | 0 } Specifies whether to add a status bar at the bottom of the window. Default is yes. menubar={ yes | no | 1 | 0} Specifies whether to display the menu bar. Default is yes. scrollbars={ yes | no | 1 | 0} Specifies whether to display horizontal and vertical scroll bars. Default is yes. resizable={ yes | no | 1 | 0} Specifies whether to display resize handles at the corners of the window. width=number Sets the width of the window, in pixels. Minimum value should be 100. height=number Specifies the height of the window, in pixels. Minimum value should be 100. top=number Specifies the top position, in pixels. This value is relative to the upper-left corner of the screen. left=number Specifies the left position, in pixels. This value is relative to the upper-left corner of the screen. replace Optional. A boolean value specifying whether the URL that is loaded into the new page should create a new entry in the window's browsing history or replace the current entry in the browsing history. If true, no new history entry is created.
Returns a reference to the new window. Use this reference to script properties and methods on the new window.
A name for the new window can be used as a target for a form or an A element. By default, the open() method creates a window that has a default width and height and the standard menu, toolbar, and other features of Internet Explorer. You can alter this set of features by using the features parameter. This parameter is a string consisting of one or more feature settings. The replace parameter controls whether the new window is put into the browser history list.
For example, the following creates a new window that contains Sample.htm. The new window is 200 by 400 pixels, has a status bar, but does not have a toolbar, menu bar, or address field.
window.open("sample.htm",null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
Opens a stream to collect the output of write or writeln methods.
document.open(mimeType, replace)
Parameter Description mimeType Currently supports "text/html" only. replace Optional. String ("replace") indicating whether you want the new document you are writing to replace the current document in the History list. Otherwise, by default, the document you are creating will not replace the current document in the History list.
No return value.
The following example replaces the document with the new document.
document.open("text/html", "replace")
Retrieves the parent element for the given text range. The parent element is the element that completely encloses the text in the range.
element = object.parentElement( )
Returns an element object if successful, or null otherwise.
If the text range spans text in more than one element, this method returns the smallest element that encloses all the elements. When you insert text into a range that spans multiple elements, the text is placed within the parent element rather than in any of the contained elements.
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.
The following JScript example retrieves the parent element for the text range created from the current selection and displays the tag name of the element.
var sel = document.selection; var rng = sel.createRange(); var el = rng.parentElement(); alert(el.tagName);
Pastes HTML text into the given text range. The text completely replaces any previous text and HTML elements in the range.
object.pasteHTML(htmlText)
Parameter Description htmlText String specifying the HTML text to paste. The string can contain text and any combination of the HTML tags described in HTML Elements.
No return value.
Although this method never fails, it might alter the HTML text to make it fit the given text range. For example, attempting to paste a table cell into a text range that does not contain a table might cause the method to insert a TABLE element. For predictable results, you should paste only well-formed HTML text that is appropriate for the given text range.
Note You cannot use this method while the document is loading. Wait until the document is completely downloaded.
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.
The following JScript example replaces the current selection with a new paragraph.
var sel = document.selection; if (sel!=null) { var rng = sel.createRange(); if (rng!=null) rng.pasteHTML("<P><B>Selection has been replaced.</B>"); }
Allows viewing the previous page of records in the data set to which the table is bound.
object.previousPage
No return value.
The number of records displayed in the table is determined by the dataPageSize property of the table. The Web author must set the DATAPAGESIZE attribute when designing the page or set the corresponding dataPageSize property at run time for this method to have any effect.
Note The page author does not need to check for boundary conditions.
Displays a Prompt dialog box with a message and an input field.
object.prompt([message [, inputDefault]])
Parameter Description message Optional. (String) String to display. inputDefault Optional. (String) String or integer that represents the default value of the input field.
Returns the value that the user types in.
If the inputDefault parameter is not supplied, the dialog box displays the value <undefined>. You have no control over the title of the prompt box.
Returns whether the command can be successfully executed using ExecCommand now, given the current state of the document.
Boolean = object.queryCommandEnabled(command)
Parameter Description command (String) String that specifies the command to query. Can be any valid command identifier.
Returns TRUE if the command is enabled, or FALSE otherwise.
Note: queryCommandEnabled("delete") on TextRange returns TRUE, while queryCommandEanbled("delete") on Document returns FALSE, but you can still use execCommand("Delete") to delete the selected text.
execCommand, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue
Returns whether the specified command is in the indeterminate state.
Boolean = object.queryCommandIndeterm(command)
Parameter Description command (String) String that specifies the command to query. Can be any valid command identifier.
Returns TRUE if indeterminate, or FALSE otherwise.
As an example, given a text range, if some of the characters are bold and others are not, queryCommandIndeterm for bold would return TRUE.
execCommand, queryCommandEnabled, queryCommandState, queryCommandSupported, queryCommandValue
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.