Creates a new cell in the table row (tr), and adds the cell to the cells collection.
dhtml语法
otd = tr.insertcell( [iindex])
parameters
iIndex |
Optional.
Integerthat 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.
DHTML代码范例
This example uses the insertCell method to add a cell to the end of the tr.
myNewCell = document.all.myTable.rows[0].insertCell()
是否符合公共标准
This method is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To
更多语法参考
deletecell, insertRow