title: Javascript to add the numbers delimited by comma
body: <p>I am trying to get the sum of all the integers whithin a text box. The numbers are separated by comma. I need to add the numbers and get their sum.I am not able to get them sadly.</p>
  
  <p>my code is :</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
          function computeData()
          {
              var data = document.getElementById("data").value;
              var temp = data.split(",");
              for( i=0; i&lt;temp.length; i++)
              var k=0;
              {
                  var j = temp[i];
                  k  = k + j;
                  alert(k);
              }
              document.getElementById("sum").value= k;
          }
      &lt;/script&gt;
  </code></pre>