JavaScript Reference/Javascript Properties/cellIndex

Материал из Web эксперт
Перейти к: навигация, поиск

"cellIndex" Example

   <source lang="javascript">
   

<html> <body> Click in any cell to view the cellIndex value.

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3


<button onclick="alert(myTable.cols);">cols</button> <script language="JavaScript">

   function function1(elem) {
       alert("Cell Index :"+ elem.cellIndex);
   }

</script> </body> </html>


     </source>
   
  


"cellIndex" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<td> <th> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"cellIndex" Syntax and Note

   <source lang="javascript">

Note: Read-only property. Returns the zero-based index of the cell in its row.

Syntax:

document.getElementById("elementID").cellIndex document.all.elementID.cellIndex // IE only


     </source>