title: javascript to add 2 numbers in textboxes in asp.net, doesnt work
body: <p>this is my javascript to get addition of 2 values from 2 textboxes into the third....</p>
  
  <p>its not working... </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function calculate(ctrl1, ctrl2, ctrl3) {
  
          var c1 = document.getElementById(ctrl1);
          var c2 = document.getElementById(ctrl2);
          var c3 = document.getElementById(ctrl3);
  
          if (c1 != null &amp;&amp; c2 != null &amp; c3 != null) {
              c3.value = Number(c1.value) + Number(c2.value);
  
          }
          document.forms[0].txteanum.focus();
  
      }    
  &lt;/script&gt;
  </code></pre>
  
  <p>in textboxes</p>
  
  <pre><code>&lt;asp:TextBox ID="txtQuantity" runat="server" onblur='javascript:calculate("txtQuantity","txtRate","TxtAmount")'&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>check my answer here <a href="https://stackoverflow.com/a/11624756/1445836">https://stackoverflow.com/a/11624756/1445836</a></p>