Facebook
From Ample Peafowl, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 123
  1. <script>
  2. function sumValues()
  3. {
  4.   var num1, num2, res;
  5.   num1 = document.getElementById("txtnum1");
  6.   num2 = document.getElementById("txtnum2");
  7.   res = document.getElementById("txtres");
  8.   res=num1+num2;
  9.   document.getElementById("txtres").innerHTML = res;
  10. }
  11.  
  12. </script>
  13.  
  14.  
  15. <form name="formcalc">
  16. <input type="text" id="txtnum1"><br>
  17. <input type="text" id="txtnum2"><br>
  18.  
  19. <input type="button" value="Calculate" onClick="sumValues()"><br>
  20. <input type="text" id="txtres"><br>
  21. </form>
  22.