insertCell Method

DHTML, HTML, & CSS

 
Click to return to the DHTML, HTML & CSS home page    
insertBefore Method     insertRow Method     DHTML Methods    

insertCell Method


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

Syntax

oTD = TR.insertCell([iIndex])

Parameters

iIndexOptional. Integer that specifies where to insert the cell in the TR. The default value is -1, which appends the new cell to the end of the cells collection.

Return Value

Returns the TD element object if successful, or null otherwise.

Remarks

The preferred technique for inserting a cell is to add the cell at the end of the cells collection. It is faster to add a cell at the end of a row than somewhere in the middle. To add a cell at the end of the collection, specify the -1 value, or the length of the cells collection minus 1.

Example

This example uses the insertCell method to add a cell to the end of the TR.

myNewCell = document.all.myTable.rows[0].insertCell() 

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.

TR

See Also

deleteCell, insertRow


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.