实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function insRow()
6
{
7
var x=document.getElementById('myTable').insertRow(0);
8
var y=x.insertCell(0);
9
var z=x.insertCell(1);
10
y.innerHTML="NEW CELL1";
11
z.innerHTML="NEW CELL2";
12
}
13
</script>
14
</head>
15
16
<body>
17
<table id="myTable" border="1">
18
<tr>
19
<td>Row1 cell1</td>
20
<td>Row1 cell2</td>
21
</tr>
22
<tr>
23
<td>Row2 cell1</td>
24
<td>Row2 cell2</td>
25
</tr>
26
<tr>
27
<td>Row3 cell1</td>
28
<td>Row3 cell2</td>
29
</tr>
30
</table>
31
<br>
32
<input type="button" onclick="insRow()" value="Insert row">
33
34
</body>
35
</html>