function addRow(billingTable)
{
var table = document.getElementById(billingTable);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for (var i = 0; i < colCount; i++)
{
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
// after this line the new cell is created but it also copies the
// value from the 1st row of the table.How can I set the value of
// this new cell to null or blank string ??
switch(newcell.childNodes[0].type)
{
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
}
}
}
问问题
2657 次