当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM cells 集合
The cells collection returns an array containing each cell in a table.
cells集合可返回包含表格中每个单元的数组
tableObject.cells[] |
<html> <head> <script type="text/javascript"> function cell() { var x=document.getElementById('myTable').cells alert(x[0].innerHTML) } </script> </head> <body> <table id="myTable" border="1"> <tr> <td>cell 1</td> <td>cell 2</td> </tr> <tr> <td>cell 3</td> <td>cell 4</td> </tr> </table> <form> <input type="button" onclick="cell()" value="Alert first cell"> </form> </body> </html> |
InnerHTML of a cell
往一个cell里innerHTML