title: Javascript to add values of a table
body: <p>my HTML code looks like this</p>
  
  <pre><code>&lt;TR Row="1" CLASS="ThemeAlignCenter"&gt;
                  &lt;TD id="wrdActive_Row1" style="width: 50px"
                      CLASS="rdThemeDataTableCell"&gt;&lt;SPAN id="lblactive_Row1"&gt;6&lt;/SPAN&gt;&lt;/TD&gt;
  
  ... more rows
  </code></pre>
  
  <p>I want to put a javascript at the end of the page to add all of the the values of lblactive_row1 when ever it appears in the page (in this example the number 6)</p>
  
  <p><strong>Edit: more source</strong></p>
  
  <pre><code>    &lt;TABLE style="" border="0" CLASS="rdThemeDataTable" id="dtWardData"
                  cellspacing="0"&gt;
                  &lt;COL id="wrdActive"&gt;&lt;/COL&gt;
                  &lt;COL id="wrdOccupied"&gt;&lt;/COL&gt;
                  &lt;TR Row="1" CLASS="ThemeAlignCenter"&gt;
                      &lt;TD id="wrdActive_Row1" style="width: 50px"
                          CLASS="rdThemeDataTableCell"&gt;&lt;SPAN id="lblactive_Row1"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;
                      &lt;TD id="wrdOccupied_Row1" style="width: 50px"
                          CLASS="rdThemeDataTableCell"&gt;&lt;SPAN id="lblOccupied_Row1"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;
                  &lt;/TR&gt;
              &lt;/TABLE&gt;
  
     &lt;TABLE style="" border="0" CLASS="rdThemeDataTable" id="dtWardData"
                  cellspacing="0"&gt;
                  &lt;COL id="wrdActive"&gt;&lt;/COL&gt;
                  &lt;COL id="wrdOccupied"&gt;&lt;/COL&gt;
  
                      &lt;TD id="wrdActive_Row1" style="width: 50px"
                          CLASS="rdThemeDataTableCell"&gt;&lt;SPAN id="lblactive_Row1"&gt;6&lt;/SPAN&gt;&lt;/TD&gt;
                      &lt;TD id="wrdOccupied_Row1" style="width: 50px"
                          CLASS="rdThemeDataTableCell"&gt;&lt;SPAN id="lblOccupied_Row1"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;
  
                  &lt;/TR&gt;
              &lt;/TABLE&gt;
  
      Repeat...
  </code></pre>
  
  <p>it goes on like that for another 10 or so tables, all in the same source. editting the html is out of the question because its generated by a third party tool. all i can is add a little script at the end </p>