JS 点击添加按钮实现多行多列效果
<table id="addFeeMgmt" width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
<tr class="titleLine">
<td width="3%" ><input id="all" value="" type="checkbox"/></td>
<td width="15%">收费项目</td>
<td width="13%">单价</td>
<td width="10%">数量</td>
<td width="13%">总金额</td>
<td width="15%">商户号</td>
<td width="15%">终端号</td>
<td width="15%">备注</td>
</tr>
</table>
-------------------------------------------------------------------------------------
function addData(){
var tabObj=$("addFeeMgmt");
var row=optionTable.addRow("last");
var cd = tabObj.rows.length;
optionTable.addTd(row,"checkbox"); //第一行
var itemTypeObj="<select style=\"width:150px\" id=\"itemType\" name=\"parameter['itemType']\" >";
<s:iterator value="itemTypeList.keySet()" id="key" status="status">
itemTypeObj+="<option value=\"<s:property value='key'/>\"><s:property value='itemTypeList.get(#key)'/></option>";
</s:iterator>
itemTypeObj+=" </select>";
var tdObj = optionTable.addTd(row,"text",itemTypeObj);
optionTable.addTd(row,"text",'<input size="15" name="parameter[\'price\']" id="price" value="" onblur="togtotal()">');//单价
//onkeypress="return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"
optionTable.addTd(row,"text",'<input size="10" name="parameter[\'number\']" id="number" value="" onblur="togtotal()">');//数量
optionTable.addTd(row,"text",'<input size="15" readonly name="parameter[\'total\']" id="total" value="" >');//单价*数量=金额
//var total = Math.floor(parseFloat(price*100 * quantity))/100;//计算总价 terminalNo
optionTable.addTd(row,"text",'<input size="20" name="parameter[\'shopNo\']" id="shopNo" value="" onblur="stVal()">');//商户
optionTable.addTd(row,"text",'<input size="20" name="parameter[\'terminalNo\']" id="terminalNo" value="" onblur="stVal()">');//终端
optionTable.addTd(row,"text",'<input size="20" name="parameter[\'cfiremark\']" id="cfiremark" value="">');//备注
}