Delete the current line with javascript and add the line of of sample code


**Delete rows **

<script>  
  function   del(obj)  
  {  
        obj.parentNode.parentNode.removeNode(true);  
  }    
  </script>  
  <body>  
  <table>  
  <tr>
      <td> The cell 1</td>
      <td><input   type=button   value="delete   this   row"   onclick="del(this)"></td>
   </tr
   <tr>
       <td> The cell 2</td>
      <td><input   type=button   value="delete   this   row"   onclick="del(this)"></td>
   </tr>
    <tr>
       <td> The cell 3</td>
      <td><input   type=button   value="delete   this   row"   onclick="del(this)"></td>
   </tr>
  </table>  
  </body>

**Add the line **

<script>

 function uf_test(){
  //Get the table object
   var tbTable = document.getElementById("tb_test");
   //Insert a row
   var trT = tbTable.insertRow();

   //I get td for the previous row
   var nRows = tbTable.rows[0].cells.length;

   //Loop the td number of the previous row to insert td
   for(var i = 0; i < nRows ; i++){
    //Create a td object
    var tdT = document.createElement("TD");
    //Assign a value to a td object
    //tdT.innerHTML="sfsdf"; 
    tdT.innerText="sfsdf";
    //Add td to tr
    trT.appendChild(tdT);
   }
 }

</script>
<table id="tb_test" border="1">
 <tr>
 <td><input type="text"></td>
 </tr>
</table>
<input type="button" onclick="uf_test();" value=" Add a line ">