Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <!doctype>
  2. <html>
  3. <head>
  4. <title>Esercizio 11</title>
  5. <meta charset="UTF-8">
  6. <script>
  7. function somma()
  8. {
  9. var addendo1 = document.getElementById("addendo1").value;
  10. var addendo2 = document.getElementById("addendo2").value;
  11. var somma = parseFloat(addendo1) + parseFloat(addendo2);
  12. alert("La somma รจ: "+somma);
  13. }
  14. </script>
  15. </head>
  16. <body>
  17. <form>
  18. <p>
  19. <label>Addendo 1</label>
  20. <input type="text" id="addendo1" name="Addendo 1" value="" placeholder=" Inserisci il primo numero">
  21. </p>
  22.  
  23. <p>
  24. <label>Addendo 2</label>
  25. <input type="text" id="addendo2" name="Addendo 2" value="" placeholder=" Inserisci il secondo numero">
  26. </p>
  27. <button type="button" onclick="somma()">Calcola la somma </button>
  28. </form>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement