Advertisement
476179

Matthews activity 7.3

Dec 19th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ex1.loops</title>
  6. </head>
  7.  
  8. <body>
  9. <script>
  10. /*
  11. var num1 = parseFloat(prompt("enter a number between 1 and 10 (1 and 10 included)"));
  12.  
  13. while(num1 > 10 || num1 < 1)
  14. {
  15. document.write("The value entered is not valid. Please try again since" + num1 + " is not between 1 and 10");
  16. num1 = parseFloat(prompt("Enter a number between 1 and 10 (1 and 10 included)"));
  17. }
  18. document.write("Thank you! The number you entered, "+ num1 +" is between 1 and 10.");
  19. */
  20.  
  21.  
  22. var num = parseFloat(prompt("Please enter a number between one and ten!"))
  23.  
  24. while(num > 1 || num < 10)
  25. {
  26. alert("Thank you! The value you entered, " + num + ", is between one and ten. Yay!")
  27. }
  28. alert("Sorry! The number you entered, " + num + ", is not between one and ten. Please try again!")
  29.  
  30. </script>
  31. </body>
  32.  
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement