title: Javascript adding integers
body: <p>How do I add a simple integer to another integer in Javascript?</p>
  
  <p>I'm getting NaN as the value for total.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var total = 0;
  document.getElementById("dds1").onkeyup = function() {
      total = total + parseInt(this.value,10);
      updateIt();
  
  };
  
  function updateIt() {
  //tofixed(2)
      document.getElementById("mySpan").innerHTML = total;
  }
  </code></pre>
  
  <p>But if I do the following:</p>
  
  <pre><code>total = parseInt(this.value,10);
  </code></pre>
  
  <p>then total has a value (an integer value).</p>