我想最后在这个表中添加和删除行我怎么能做到这一点
<table align="left" id="postq" style="display: none;" border="2" style="width: 519px">
<tr>
<th align="left"><label id="Label1"> Kind of Work </label></th>
<th align="left"><label id="Label1"> Name Of The Client </label></th>
<th align="left"><label id="Label1">Name of Firm / Organisation </label></th>
</tr>
<tr>
<td>
<input title="Enter Kind Of work 1" readonly="readonly" onclick="if(this.value!=''){this.value='';opendrop1();}else{opendrop1();}" id="other_work1" name="other_work1" type="text" size="30" <?php if (isset($errors)) { echo 'value="'.htmlentities($_POST['other_work1']).'"'; } ?> >
</td>
<td><input name="client_name1" type="text" id="client_name1" size="40" /></td>
<td><input name="firm_name1" type="text" id="firm_name1" size="40"/></td>
</tr>
</table>
我已经添加了这个脚本
<!--add kind of work rows-->
<script type="text/javascript">
$(document).ready(function () {
var counter = 2;
$("#addButton").click(function () {
if (counter > 10) {
alert("Only 10 textboxes allow");
return false;
}
var $row = $('<tr>');//$('<tr id="row'+counter+'"></tr>')
$row.html('<td><input title="Enter Kind Of work " readonly="readonly" onclick="if(this.value!=''){this.value='';opendrop();}else{opendrop();}" id="other_work' + counter + '" name="other_work' + counter + '" type="text" size="30" onclick="opendrop()" <?php if (isset($errors)) { echo 'value="'.htmlentities(@$_POST['other_work' + counter + '']).'"'; } ?>> </td>
<td><input name="client_name' + counter + '" type="text" id="client_name' + counter + '" size="40"/></td>
<td><input name="firm_name' + counter + '" type="text" id="firm_name' + counter + '" size="40"/></td>');
$('#postq').append($row);
counter++;
});
</script>
还有这个按钮,但它仍然不起作用
<input type='button' value='Add Button' id='addButton' />