jquery 增添删除 table tr

jquery 添加删除 table tr

<html>
   <script type="text/javascript" src="jquery.js"></script>
   <body>
        <button onclick="javascript:addCurrentRow();" >添加</button>
  <table id="allDatas">
       <tr>
    <th>选择图片</th>
    <th>图片名称</th>
    <th>描述</th>
      </tr>

   <tr>
        <td> <input type="file" name="imageFile1"/></td>
     <td><input name="imageName"></input></td>
     <td><input name="note" /> </td>
     <td><a href="javascript:;" onclick="deleteCurrentRow(this);"><font color='red'>删除</font></a>  </td>
      </tr>
  </table>
    <script>
      

    function  addCurrentRow(){
        var trcomp="<tr><td> <input type='file' name='imageFile'/></td><td><input name='imageName'></input></td><td><input name='note' /></td><td><a href='javascript:;' onclick='deleteCurrentRow(this);'><font color='red'>删除</font></a>  </td>";
     $("#allDatas tr:last-child").after(trcomp);
    }
    function  deleteCurrentRow(obj){
       var isDelete=confirm("真的要删除吗?"); 
   if(isDelete){
    var tr=obj.parentNode.parentNode;  
    var tbody=tr.parentNode;  
    tbody.removeChild(tr);  
   }
    }
 </script>
   </body>

</html>