TableData cellIndex eigenschap

Definitie en gebruik

cellIndex Eigenschap retourneert de positie van de cel in de celverzameling van de tabelrij.

Zie ook:

HTML referentiemanual:HTML <td> tag

Voorbeeld

Voorbeeld 1

Klik op verschillende cellen om hun indexpositie te tonen:

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

Try it yourself

Voorbeeld 2

Geef de indexpositie van elke cel in de tabelrij terug:

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

Try it yourself

Syntax

Returns the cellIndex property:

tabledataObject.cellIndex

Technical details

Return value: A number that represents the position of the cell in the cell collection of the table row.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support