Advertisement
myrosvas

Untitled

Sep 4th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <title></title>
  5. </head>
  6.  
  7. <body>
  8. First: <input type='text' id='num1'>
  9. Second: <input type='text' id='num2'>
  10. <br>
  11. <input type="button" onClick="addBy()" value="Add"><br>
  12. <div id="output"></div>
  13. <script>
  14. var output = document.getElementById('output');
  15. var num1 = document.getElementById('num1');
  16. var num1 = document.getElementById('num2')
  17. ;
  18.  
  19. function addBy(){
  20. var a = Number(num1.value);
  21. var b = "+"
  22. var c = Number(num2.value);
  23. var d = a+c;
  24. outHTML(a,b,c,d)
  25. }
  26.  
  27. function outHTML(a,b,c,d){
  28. output.innerHTML += a + ' ' + b + ' ' + c + ' = ' + d + '<br>'
  29. ;
  30. }
  31. </script>
  32. </body>
  33.  
  34. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement