Js to get table cell information
Obtains the content of a cell in a table.
Var tid = listFrame. now. rows [1]. cells [2]. innerHTML;
ListFrame refers to a window or frame.
Now indicates the table id.
Rows [I] refers to a row, such as the property: length
Cells [j] indicates a cell rows [I]. cells [j] indicates column j of row I.
InnerHTML refers to the cell value.
Example: <! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<Meta name = "Generator" CONTENT = "EditPlus">
<Meta name = "Author" CONTENT = "">
<Meta name = "Keywords" CONTENT = "">
<Meta name = "Description" CONTENT = "">
</HEAD>
<BODY onload = "getTableValue ()">
<Script language = "javascript">
Function getTableValue (){
Alert (document. getelementbyid ('table1'). Rows [0]. cells [0]. innerhtml );
// Or
Alert (document. getelementbyid ('table1'). Rows. Item (0). cells. Item (0). innerhtml );
}
</SCRIPT>
<Table id = "Table1">
<Tr>
<TD> 1 </TD>
<TD> 2 </TD>
</Tr>
<Tr>
<TD> 3 </TD>
<TD> 2 </TD>
</Tr>
</Table>
</BODY>
</HTML> Note: To be compatible with IE and FireFox, do not use innerText.