87,996
社区成员




<table class="am-table">
<tr>
<td width="5%">第</td>
<td width="20%"><input name="beginday[]" type="text" value="1" /></td>
<td width="10%">天到</td>
<td width="20%"><input name="endday[]" type="text" /></td>
<td width="5%">天</td>
<td width="20%"><input name="unitprice[]" type="text"/></td>
<td width="15%">(元/天)</td>
<td><a href="javascript:void()" onclick="removeItem(this)"><span class="am-icon-remove"></span></a></td>
</tr>
</table>
<input onclick="add()" type="button" value="增加"/>
function add(){
$("tbody").append("<tr>"
+"<td width='5%'>第</td>"
+"<td width='20%'><input type='text' name='beginday[]'/></td>"
+"<td width='10%'>天到</td>"
+"<td width='20%'><input type='text'name='endday[]'/></td>"
+"<td width='5%'>天</td>"
+"<td width='20%'><input type='text' name='unitprice[]'/></td>"
+"<td width='15%'>(元/天)</td>"
+"<td><a href='javascript:void()' onclick='removeItem(this)'><span class='am-icon-remove'></span></a></td>"
+"</tr>"
);
}
<table class="am-table">
<tr>
<td width="5%">第</td>
<td width="20%"><input name="beginday[]" type="text" value="1" /></td>
<td width="10%">天到</td>
<td width="20%"><input name="endday[]" type="text" /></td>
<td width="5%">天</td>
<td width="20%"><input name="unitprice[]" type="text"/></td>
<td width="15%">(元/天)</td>
<td><a href="javascript:void()" onclick="removeItem(this)"><span class="am-icon-remove"></span></a></td>
</tr>
</table>
<input onclick="add()" type="button" value="增加"/>
<script type="text/javascript">
function add(){
var ft = parseInt($("tbody input:eq(-2)").val(), 10)+1;
if (isNaN(ft)) {
alert("不能增加");
return;
}
$("tbody").append("<tr>"
+"<td width='5%'>第</td>"
+"<td width='20%'><input type='text' name='beginday[]' value='"+ft+"'/></td>"
+"<td width='10%'>天到</td>"
+"<td width='20%'><input type='text'name='endday[]' /></td>"
+"<td width='5%'>天</td>"
+"<td width='20%'><input type='text' name='unitprice[]'/></td>"
+"<td width='15%'>(元/天)</td>"
+"<td><a href='javascript:void()' onclick='removeItem(this)'><span class='am-icon-remove'></span></a></td>"
+"</tr>"
);
}
</script>
<table class="am-table">
<tr>
<td width="5%">第</td>
<td width="20%"><input name="beginday[]" type="text" value="1" /></td>
<td width="10%">天到</td>
<td width="20%"><input name="endday[]" type="text" value="2" /></td>
<td width="5%">天</td>
<td width="20%"><input name="unitprice[]" type="text"/></td>
<td width="15%">(元/天)</td>
<td><a href="javascript:void()" onclick="removeItem(this)"><span class="am-icon-remove"></span></a></td>
</tr>
</table>
<input onclick="add()" type="button" value="增加"/>
<script type="text/javascript">
function add(){
var ft = parseInt($("tbody input:eq(-2)").val(), 10)||0;
$("tbody").append("<tr>"
+"<td width='5%'>第</td>"
+"<td width='20%'><input type='text' name='beginday[]' value='"+(ft+1)+"'/></td>"
+"<td width='10%'>天到</td>"
+"<td width='20%'><input type='text'name='endday[]' value='"+(ft+2)+"'/></td>"
+"<td width='5%'>天</td>"
+"<td width='20%'><input type='text' name='unitprice[]'/></td>"
+"<td width='15%'>(元/天)</td>"
+"<td><a href='javascript:void()' onclick='removeItem(this)'><span class='am-icon-remove'></span></a></td>"
+"</tr>"
);
}
</script>