476179

Conditionifelseif

Oct 31st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>conditional example: if, elseif </title>
  6. </head>
  7.  
  8. <body>
  9. <script>
  10.  
  11. var mark =parseFloat(prompt("enter a mark"));
  12.  
  13. if (mark >= 75)
  14. {// if the condition above is true this will be exectued if its false the code between the next braces will be executed
  15. alert( "Very good work!");
  16. }
  17. else if (mark >= 65)
  18. {
  19. alert("Good work,");
  20.  
  21. }
  22. else if (mark >= 60)
  23. {
  24. alert("satasfactory work");
  25.  
  26. }
  27. else if (mark >= 50)
  28. {
  29. alert("work harder.");
  30.  
  31. }
  32. else
  33. {
  34. alert("Mark is below 50%. You are not passing. ");
  35. }
  36.  
  37.  
  38. </script>
  39. </body>
  40.  
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment