TableHeader cellIndex Property
Definition and Usage
cellIndex
Property returns the index of the cell in the table row cells collection position.
See also:
HTML Reference Manual:HTML <th> Tag
Instance
Example 1
Click on different cells to prompt their index positions:
alert("Cell index is: " + x.cellIndex);
Example 2
Return the index position of each cell in the table row:
var x = document.getElementsByTagName("th"); var txt = ""; var i; for (i = 0; i < x.length; i++) { txt = txt + "The index of Cell "+(i+1)+" is: "+x[i].cellIndex+"<br>"; }
Syntax
Returns the cellIndex property:
tableheaderObject.cellIndex
Technical Details
Return Value: | Number, representing the position of the cell in the cells collection of the table row. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |