Advertisement
dimkiriakos

calculations

Sep 6th, 2021
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Test</title>
  8. </head>
  9. <body>
  10. <label for="">α</label>
  11. <input id="a" type="number" placeholder="Εισάγετε το α"><br>
  12. <label for="">β</label>
  13. <input id="b" type="number" placeholder="Εισάγετε το β"><br>
  14. <p id="c"></p>
  15. <button onclick="add()">υπολογισμός</button>
  16. <script>
  17. function add(){
  18. var a = document.getElementById('a').value;
  19. console.log(a);
  20. var b = document.getElementById('b').value;
  21. console.log(b);
  22. var c = parseFloat(a) + parseFloat(b);
  23. document.getElementById('c').innerHTML = c;
  24. }
  25. </script>
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement