<script language="javascript">
iIndex = 1;
var annex = 1;
var i=1;
function getIndex(){
iIndex = event.srcElement.parentElement.parentElement.rowIndex;
return iIndex;
}
function insertRow(iPos){
var otr=myTable.insertRow(annex);//插入一个tr
var ocell=otr.insertCell(0);//插入一个td
ocell.innerHTML="" + i + "";
var ocell=otr.insertCell(1);//插入一个td
ocell.innerHTML="<input type=text size=20 name=annexValue(" + i+ ") id=annexValue(" + i + ")>";
var ocell=otr.insertCell(2);//插入一个td
ocell.innerHTML="<input type=text size=20 name=annex(" + i + ") id=annexValue(" + i + ")>";
var ocell=otr.insertCell(3);//插入一个td
ocell.innerHTML="<td><input type=button οnclick=deleteRow(getIndex()) value='删除'></td>";
annex++;
document.getElementById("zjLength").value=annex;
i++;
}
function deleteRow(iPos){
document.all.myTable.deleteRow(iPos);
--annex;
document.getElementById("zjLength").value=annex;
}
</script>
<form name=myForm>
<a href="#" onClick="insertRow(0)">添加回避专家</a>
<tr>
<td colspan="4" name='提交行数'>
<input type="text" name="zjLength" id="zjLength" />
</td>
</tr>
<table id="myTable">
<tr>
<td>序号</td>
<td>回避专家</td>
<td>备注</td>
<td>删除</td>
</tr>
</table>
</form>