td/th cellIndexPropriété

td/th 对象参考手册Objet td/th

Définition et utilisation

La propriété cellIndex renvoie la position d'une cellule dans la collection de cellules de la ligne.

Syntaxe

Renvoie la propriété cellIndex :

tdObject.cellIndex

Or

thObject.cellIndex

Astuce :La propriété cellIndex n'a pas de valeur par défaut.


Prise en charge des navigateurs

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Tous les principaux navigateurs prennent en charge la propriété cellIndex.


Exemple

Exemple

Afficher la position de la cellule (cellIndex) :

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(x){
    alert("Cell index is: " + x.cellIndex);
}
</script>
</head>
<body>

<table border="1">
    <tr>
<td onclick="displayResult(this)">Cliquez pour afficher l'index de la cellule</td>
<td onclick="displayResult(this)">Cliquez pour afficher l'index de la cellule</td>
    </tr>
</table>

</body>
</html>

Essayez-le vous-même »


td/th 对象参考手册Objet td/th Autres extensions