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