在应用开发中会经常用到动态表的操作
主要以下方面
//返回表格新添加的行
var row = document.getElementById("table").insertRow(-1);
//得到表格新添加行的索引
var index = row.rowIndex;
//得到表的所有行数组
var rows = document.getElementById("table").rows;
//得到表格列数组
var cells = document.getElementById("table").rows[0].cells;
//得到表格中一个input标签的值
var value = cells[0].children[0].value;
//删除表格中的行
table.deleteRow(index);
//表格中如果有select的话
var fromOptions = document.getElementById("autoTable0").options;
var toOptions = document.getElementById("autoTable"+(index)).options;
for(var i =0 ;i<fromOptions.length;i++){
toOptions[i] = new Option(fromOptions[i].text,fromOptions[i].value);
}