//增加行

function doAddRow()
{
var bodyObj=document.getElementById("fm2_table_body"); //tbody 的id
var rowCount = bodyObj.rows.length;
var newRow = bodyObj.insertRow(rowCount++);
var C1 = newRow.insertCell(0);
var C2 = newRow.insertCell(1);

 

C1.setAttribute("className","td_class_1");
C2.setAttribute("className","td_class_1");

 

C1.innerHTML = "";
C2.innerHTML = "";

 

}

 

//删除行

function doDelete(inputobj){
if(inputobj==null) return;
var parentTD = inputobj.parentNode;
var parentTR = parentTD.parentNode;
var parentTBODY = parentTR.parentNode;
parentTBODY.removeChild(parentTR);
}

 

action中自动封装列表的数据:

 

将actionForm中该表格的每一列属性定义为数组类型,这样在action中就会自动封装为数组,在Dao中直接操作数组即可。