insertRow
insertRow() 方法
Definition and Usage
定义与用法
The insertRow() method is used to insert a new row in a specified position in a table.
insertRow()方法可用来往表格中的指定位置上插入新行
Syntax 语法
tableObject.insertRow(index)//索引,增添新行
--------------------------------------------------------------------------------
Example 举例
<html>
<head>
<script type="text/javascript">
function insRow()
{
document.getElementById('myTable').insertRow(0)//在文档中寻找控件
}
</script>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<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="insRow()"
value="Insert new row before the first row">//value为控件上将要显示的内容
</form>
</body>
</html>