SHARE
TWEET

Untitled

a guest Aug 12th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function performCalc()
  5. {
  6.     var firstBox = parseInt(document.getElementById("num1").value);
  7.     var secondBox = parseInt(document.getElementById("num2").value);
  8.     var calcResult = firstBox + secondBox;
  9.  
  10.     document.average.result.value = calcResult;
  11. }
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. <form method="post" action="" name="average">
  17. <p>
  18. First number:
  19. <br>
  20. <input type="text" id="num1" name="num1" value="5"/>
  21. </p>
  22.  
  23. <p>
  24. Second number:
  25. <br>
  26. <input type="text" id="num2" name="num2" value="4"/>
  27. </p>
  28.  
  29. Final Result:
  30. <br>
  31. <input type="text" id="result" name="result"/>
  32. </p>
  33.  
  34. <input type="button" value="Click me!" onclick="performCalc()" />
  35. </form>
  36. </body>
  37. </html>
RAW Paste Data
Top