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