title: javascript add new row in a table
body: <p>I am trying to add a new row in a table via javascript. 
  I want to have the row inserted before the last row where the sum is, and also the number in the label to be incremented with each new row inserted in a table. </p>
  
  <pre><code>&lt;input type=button value='Add Row' /&gt;
  
  &lt;table cellspacing=0 cellpadding=4 id="table"&gt;
  &lt;tr&gt;&lt;td&gt;Number 1:&lt;/td&gt;&lt;td&gt;&lt;input value=20 style="width:30px" type=text  maxlength=2/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Number 2:&lt;/td&gt;&lt;td&gt;&lt;input value=25 style="width:30px" type=text  maxlength=2/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style="border-top:solid 1px black;border-bottom:solid 1px black;"&gt;Sum:&lt;/td&gt;&lt;td style="border-top:solid 1px black;border-bottom:solid 1px black;"&gt;&lt;div&gt;45&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>That's the code for the table, I want to have it under 'number 2' row, but before the sum row. 
  And with each new row the label to be changed to Number 3: for example or Number 4, etc.
  Any idea how I can do that. I need to use only javascript and no external tools or jquery is allowed.
  Thanks in advance, Laziale</p>