TableHeader cellIndex eigenschap

Definitie en gebruik

cellIndex Eigenschap retourneert de indexpositie van de cel in de tabelrij cells collectie locatie.

Zie ook:

HTML referentiemanual:HTML <th> tag

Voorbeeld

Voorbeeld 1

Klik op verschillende cellen om hun indexpositie te zien:

alert("Celindex is: " + x.cellIndex);

Try it yourself

Voorbeeld 2

Geef de indexpositie van elke cel in de tabelrij terug:

var x = document.getElementsByTagName("th");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
  txt = txt + "De index van de Cel "+(i+1)+" is: "+x[i].cellIndex+"<br>";
}

Try it yourself

Syntax

Returns the cellIndex property:

tableheaderObject.cellIndex

Technical details

Return value: Number, indicating 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