Add values in a cell and place in totals field
<p>I am trying to add the values the user enteres into the Slots cell in each row.  I want to get the totals and place it in the SlotsTotals field.  But, the code is not working at all.</p>

<pre><code>function checkRow(){
    var table = document.getElementById('tblSample');

    for (var i = 0, row; row = table.rows[i]; i++){
            document.getElementById('SlotsTotals').value += document.getElementById('txtSlots' + i).value;
    }
 }
</code></pre>

<p>I'm dynamically adding rows to a table.  The user will input values into the slots field.  I want to loop through the table to get a total of all the values and add then total to the SlotsTotal field.</p>

<p>Here is my some of my html to add the rows.  </p>

<pre><code>function addRow() {
    //function ValidateRow(){alert('error');}
    //function insertRow();

    var tbl = document.getElementById('tblSample');
    var lastRow = tbl.rows.length;  
    // if there's no header row in the table, then iteration = lastRow + 1
    //var iteration = lastRow;
    var iteration = lastRow;
    var row = tbl.insertRow(lastRow);

    var cell5 = row.insertCell(6);            
    var element5 = document.createElement('input');            
    element5.type = 'text';            
    element5.name = 'txtSlots' + iteration; 
    element5.id = 'txtSlots' + iteration;   
    element5.size = 10;
    cell5.appendChild(element5);
  }
</code></pre>
