title: Calculate the sum of DIV content
body: <p>I have a form with several SELECT boxes and based on the user's selection a value appears. This is fully working.</p>
  
  <p>Now I want a script that calculates the SUM of these values either automatically or when pressing a button.</p>
  
  <p>The full code I have so far is this:</p>
  
  <p>The JavaScript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  window.onload=function(a,b)
  {
      value=document.getElementById('value1'),
      combobox=document.getElementById('first');
  
      combobox.onchange=function(a)
      {
      document.getElementById('value1').innerHTML = "&amp;euro; " +this.value;
      }
  
      value2=document.getElementById('value2'), 
      combobox2=document.getElementById('second');
  
      combobox2.onchange=function(b)
      {
      document.getElementById('value2').innerHTML = "&amp;euro; " +this.value;
      }
  }
  function changeText(){
  var sum;    
  sum= (value * 1) + (value2 * 1);
  document.getElementById('sum').innerHTML = "&amp;euro; " +this.value;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The HTML:</p>
  
  <pre><code>        &lt;ol&gt; 
              &lt;li&gt;&lt;label&gt;&lt;span&gt;First&lt;/span&gt;&lt;/label&gt;
              &lt;select name="block1" id="first"&gt; 
                  &lt;option value="0"&gt;Please select...&lt;/option&gt;
                  &lt;option value="1"&gt;Summer&lt;/option&gt; 
                  &lt;option value="2"&gt;Spring&lt;/option&gt; 
              &lt;/select&gt;&lt;/li&gt; 
          &lt;/ol&gt;       
          &lt;ol&gt; 
              &lt;li&gt;&lt;label&gt;&lt;span&gt;Second&lt;/span&gt;&lt;/label&gt;
              &lt;select name="block2" id="second"&gt;
                  &lt;option value="0"&gt;Please select...&lt;/option&gt; 
                  &lt;option value="1"&gt;Summer&lt;/option&gt; 
                  &lt;option value="2"&gt;Spring&lt;/option&gt; 
                  &lt;option value="3"&gt;Pink&lt;/option&gt; 
                  &lt;option value="4"&gt;Corporate&lt;/option&gt; 
              &lt;/select&gt;&lt;/li&gt; 
          &lt;/ol&gt;
  
          &lt;div id="value1"&gt;value 1&lt;/div&gt;
          &lt;div id="value2"&gt;value 2&lt;/div&gt;
  
          &lt;input type='button' onclick='changeText()' value='Calculate'/&gt; 
  
          &lt;div id="sum"&gt;Total here&lt;/div&gt;
  </code></pre>
  
  <p>If anybody could help, that would be great. I really can't figure it out. Many many thanks!!</p>