YouTip LogoYouTip

Prop Tableheader Cellindex

# TableHeader cellIndex Property [![Image 8: TableHeader Object Reference](#) TableHeader Object](#) ## Example Click on different cells to display an alert box showing their index position: alert("Cell index is: " + x.cellIndex); [Try it Β»](#) * * * ## Definition and Usage The cellIndex property returns the position of a cell in the cells collection of a table row. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The cellIndex property is supported by all major browsers. * * * ## Syntax Return the cellIndex property: _tableheaderObject_.cellIndex ## Technical Details | Return Value: | A number, representing the position of a cell in the cells collection of a table row. | | --- | * * * ## More Examples ## Example Return the index position of each cell in a table row: var x = document.getElementsByTagName("th"); var txt = ""; for (var i=0; i<x.length; i++) { txt = txt + "The index of Cell "+(i+1)+" is: "+x.cellIndex+"
"; } document.getElementById("demo").innerHTML=txt; [Try it Β»](#) * * TableHeader Object](#)
← Prop Tableheader ColspanProp Tableheader Abbr β†’