<script type="text/javascript">
var pos =4;//默认位置为4,根据自己需要,也可以通过鼠标事件获取当前行数。 function insRow() //增加TR
{
var x=document.getElementById('fb').insertRow(pos) ;
x.innerHTML= "<tr>\
<td width=\"9%\" height=\"50\" align=\"center\">版本:</td>\
<td width=\"23%\" align=\"left\"><input\
id=\"input_product_class\" class=\"input-block-level\"name=\"version\" type=\"text\"></td>\
<td width=\"6%\" align=\"center\">价格:</td>\
<td width=\"26%\" align=\"left\"><input id=\"input_product_price\" class=\"input-block-level\" name=\"pricePerUnit\" type=\"text\"></td>\
<td width=\"10%\" align=\"center\">促销价格:</td>\
<td width=\"26%\" align=\"left\"><input id=\"input_product_inventory\" class=\"input-block-level\" name=\"inventory\" type=\"text\"></td>\
<tdn onclick=\"delRow()\" class=\"close\">×<td>\
</tr>"; pos=pos+1;
}
function delRow()//删除TR,不过只能从后向前依次删除,否则就或删错。因为我的POS不是鼠标获取的,所以无法随意删除。
{
document.getElementById('fb').deleteRow(pos-1);
pos=pos-1;
} </script>