js动态生成表格
1、boday部分
<div >
<table id="InputsWrapper" border="1" >
<tr>
<th width="11%" >保险起期(年)</th>
<th width="11%" >保险止期(年)</th>
<th width="11%" >缴费起期(年)</th>
<th width="11%" >缴费止期(年)</th>
<th width="14%" >价值佣金系数(%)</th>
<th width="14%" >内部标保佣金系数(%)</th>
<th width="14%" >外部标保佣金系数(%)</th>
<th width="12%">操作</th>
</tr>
<tr >
<td ><input style=width:100px; type="text" id="insurancePeriodMin" name="insurancePeriodMin"placeholder="请输入保险起期" > </td>
<td ><input style=width:100px; type="text" id="insurancePeriodMax" name="insurancePeriodMax" placeholder="请输入保险止期" > </td>
<td ><input style=width:100px; type="text" id="renewPeriodMin" name="renewPeriodMin"placeholder="请输入缴费起期" > </td>
<td ><input style=width:100px; type="text" id="renewPeriodMax" name="renewPeriodMax" placeholder="请输入缴费止期" > </td>
<td ><input style=width:100px; type="text" id="valueCommissionCoefficient" name="valueCommissionCoefficient"placeholder="请输入价值佣金系数" > </td>
<td ><input style=width:100px; type="text" id="inStandardCommissionCoefficient" name="inStandardCommissionCoefficient" placeholder="请输入内部标保佣金系数" > </td>
<td ><input style=width:100px; type="text" id="outStandardCommissionCoefficient" name="outStandardCommissionCoefficient" placeholder="请输入外部标保佣金系数" > </td>
<td><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" id="AddMoreFileBox" class="btn btn-info">添加</a></td>
</tr>
</table>
</div>
2、js部分
/* remove and add */
("#InputsWrapper"); //Input boxes wrapper ID
var AddButton = (AddButton).click(function (e) //on add input button click
{
if(x <= MaxInputs) //max input box allowed
{
FieldCount++; //text box added increment
FieldCounts++;
rowId++;
//add input box
("body").on("click",".removeclass", function(e){ //user click on remove text
if( x > 1 ) {
$(this).parent().parent().remove(); //remove text box '<tr "'+ FieldCount +'">'
x--; //decrement textbox
}
return false;
})
});
3、效果图