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

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

HTML DOM rows 集合


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

Definition and Usage
定义与用法

The rows collection returns an array containing each row in a table.
rows集合返回一个包含表格中每个row的数组

Syntax 语法

tableObject.rows[]


Example 举例

<html>
<head>
<script type="text/javascript">
function specifyRow()
{
alert(document.getElementById('myTable').rows[0].innerHTML)
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<form>
<input type="button" onclick="specifyRow()"
value="Show innerHTML of first row">
</form>
</body>
</html>


演练

InnerHTML of a row
往row里innerHTML

Add a cell to a table row through the rows collection
通过rows集合往表格里加cell

Align the cell content in a table row
对齐表格行里cell的内容

Vertical align the cell content in a table row
包含在表格行里cell的垂直对齐方式

Align the cell content in a single cell
仅对一个cell内容进行对齐

Vertical align the cell content in a single cell
仅对一个cell的内容进行垂直对齐

Change the content of a table cell
改变表格cell的内容

Change the colspan of a table row
改变表格row的跨度

评论 (0) All

登陆 | 还没注册?