tr sectionRowIndexPropriété

tr 对象参考手册Objet tr

Définition et utilisation

La propriété sectionRowIndex renvoie la position d'une ligne dans la collectionrowsde TBODY, THEAD ou TFOOT.

Syntaxe

Renvoie la propriété sectionRowIndex :

trObject.sectionRowIndex

Astuce :La propriété sectionRowIndex 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é sectionRowIndex.


Exemple

Exemple

Affichez la position de la ligne dans la collection Rows de THEAD, TBODY, tFoot :

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutoriel d'exemple (example.com)</title>
<script>
function displayResult(x){
    alert("Section row index is: " + x.sectionRowIndex);
}
</script>
</head>
<body>

<table border="1">
    <thead>
        <tr onclick="displayResult(this)">
<th>Cliquez pour afficher l'index de ligne</th>
        </tr>
        <tr onclick="displayResult(this)">
<th>Cliquez pour afficher l'index de ligne</th>
        </tr>
</thead>
<tbody>
        <tr onclick="displayResult(this)">
<td>Cliquez pour afficher l'index de ligne</td>
        </tr>
        <tr onclick="displayResult(this)">
<td>Cliquez pour afficher l'index de ligne</td>
        </tr>
</tbody>
<tfoot>
        <tr onclick="displayResult(this)">
<td>Cliquez pour afficher l'index de ligne</td>
        </tr>
        <tr onclick="displayResult(this)">
<td>Cliquez pour afficher l'index de ligne</td>
        </tr>
</tfoot>
</table>

</body>
</html>

Essayez-le »


tr 对象参考手册Objet tr Autres extensions