Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. function licz() {
  2. var p1 = document.getElementById("p1").value;
  3. var p2 = document.getElementById("p2").value;
  4. var p3 = document.getElementById("p3").value;
  5. if ( (p1.length<1) || (p2.length<1) || (p3.length<1) || isNaN(p1) || isNaN(p2) || isNaN(p3) )
  6. {
  7. return document.getElementById('komunikat').innerHTML="wpisz poprawne dane";
  8. }
  9. p1=parseFloat(p1);p2=parseFloat(p2);p3=parseFloat(p3);
  10. var srednia=(p1+p2+p3)/3
  11. return document.getElementById("wynik").innerHTML=srednia;
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement