<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function insRow() {
var tbl = document.getElementById('myTable');
var row = tbl.insertRow(0);
var cell = row.insertCell(0);
cell.innerHTML="new cell";
}
function delRow() {
var tbl = document.getElementById('myTable');
tbl.deleteRow(0);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>
cell
</td>
</tr>
</table>
<br />
<input type="button" onclick="insRow()" value="Insert row">
<input type="button" onclick="delRow()" value="Delete row">
</body>
</html>
参考:http://www.w3schools.com/htmldom/dom_obj_table.asp