按钮添加行

function addRow(){
var oTable = document.getElementById("oTable");
var tBodies = oTable.tBodies;
var tbody = tBodies[0];
var tr = tbody.insertRow(tbody.rows.length);
var td_1 = tr.insertCell(0);
td_1.innerHTML = "
第1列
"; var td_2 = tr.insertCell(1); td_2.innerHTML = "
第2列
"; }

你可能感兴趣的:(按钮添加行)