当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM cells 集合

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM cells 集合


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 431 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The cells collection returns an array containing each cell in a table.
cells集合可返回包含表格中每个单元的数组

Syntax 语法

tableObject.cells[]


Example 举例

<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

评论 (0) All

登陆 | 还没注册?