Advertisement
Guest User

213123

a guest
Feb 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Created by Jaroslaw on 2/21/2017.
  3.  */
  4.  
  5. var cors = document.getElementById("courses"),
  6.     durn = document.getElementById("duration"),
  7.     langs = document.getElementById("languages"),
  8.     rept = document.getElementById("reporting");
  9. var nameUser = document.getElementById("userName"),
  10.     surnameUser = document.getElementById("userSurname");
  11. var scost;
  12.  
  13. window.onload = function () {
  14.     countAll(parseInt(cors.options[cors.selectedIndex].value),
  15.         parseInt(durn.options[durn.selectedIndex].value),
  16.         parseInt(langs.options[langs.selectedIndex].value),
  17.         parseInt(rept.options[rept.selectedIndex].value));
  18. };
  19.  
  20. function countAll(c, d, l, r) {
  21.     var sumaCost;
  22.     sumaCost = d * c + l + r;
  23.     scost = sumaCost;
  24.  
  25.     document.getElementById("costSingle").innerHTML = c;
  26.     document.getElementById("costAll").innerHTML = sumaCost;
  27. }
  28.  
  29. function coursesCount() {
  30.     countAll(parseInt(cors.options[cors.selectedIndex].value),
  31.         parseInt(durn.options[durn.selectedIndex].value),
  32.         parseInt(langs.options[langs.selectedIndex].value),
  33.         parseInt(rept.options[rept.selectedIndex].value));
  34. }
  35.  
  36. function getCourse() {
  37.     if (nameUser.value !== "" && surnameUser.value !== "")
  38.         alert("Great! " + nameUser.value + " you get the course - " + cors.options[cors.selectedIndex].text + "! And total cost is - " + scost + " $");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement