table 表格的增删该查
程序员文章站
2022-03-09 10:27:30
...
function insertRow(text1,text2,text3){
var tb = document.getElementById('infoId');
var rowIndex = tb.rows.length;
rowIndex = rowIndex == '0' ? '0' :rowIndex;
var row = tb.insertRow(rowIndex);
var c1 = row.insertCell();
c1.innerHTML = text1;
var c2 = row.insertCell();
c2.innerHTML=text2;
var c3 = row.insertCell();
c3.innerHTML=text3;
}
function removeRow(){
var tb = document.getElementById("infoId");
document.getElementById('seedId').value="";
while(tb.hasChildNodes()){
tb.removeChild(tb.lastChild);
}
}
var tb = document.getElementById('infoId');
var rowIndex = tb.rows.length;
rowIndex = rowIndex == '0' ? '0' :rowIndex;
var row = tb.insertRow(rowIndex);
var c1 = row.insertCell();
c1.innerHTML = text1;
var c2 = row.insertCell();
c2.innerHTML=text2;
var c3 = row.insertCell();
c3.innerHTML=text3;
}
function removeRow(){
var tb = document.getElementById("infoId");
document.getElementById('seedId').value="";
while(tb.hasChildNodes()){
tb.removeChild(tb.lastChild);
}
}
上一篇: 很多开发人员的毛病
下一篇: 数据库表数据被误删,及时恢复