Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <html>
  2. <head>
  3.  
  4.  
  5. </head>
  6.  
  7. <body>
  8. <form name="form1">
  9. Numer kawy: <input type="number" name="liczba1"/><br>
  10. Waga kawy: <input type="number" name="liczba2"/><br>
  11. <br>
  12. <input type="button" onclick="sum()" value="Zamow"/>
  13. </form>
  14. <script>
  15. {if ((document.form1.liczba1.value=="")||(isNaN(document.form1.liczba1.value))) {alert("Błąd danych");}
  16. else
  17. if ((document.form1.liczba2.value=="")||(isNaN(document.form1.liczba2.value))) {alert("Błąd danych");}
  18. else
  19. var a = parseInt(document.form1.liczba1.value);
  20. var b = parseInt(document.form1.liczba2.value);
  21. var iloczyn = a * b;
  22. document.getElementById("wynik").innerHTML = iloczyn;
  23. }
  24. </script>
  25. </body>
  26.  
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement