Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <html lang="en">
  2. <head>
  3. <meta charset="utf-8">
  4. <link rel="stylesheet" href="style.css">
  5.  
  6. <title>Aaron Stockdale's Age Range Page</title>
  7. <script type="text/javascript">
  8. function andFunction()
  9. {
  10. var userAge = prompt("What's your age?", " ");
  11.  
  12. if(userAge >= 16 && userAge <= 18)
  13. document.getElementById('age').innerHTML = "Age entered " + userAge + "is in range. Can play in youth team.";}
  14. else
  15. document.getElementById('age').innerHTML = "Age entered " + userAge + "is not in range. Can play not in youth team.";}
  16.  
  17. }
  18.  
  19. function orFunction()
  20. {
  21. var userAge = prompt("What's your age?", " ");
  22.  
  23. if(userAge > 15 || userAge < 19)
  24. document.getElementById('age').innerHTML = "Age entered " + userAge + "is in range. Can play in youth team.";}
  25. else
  26. document.getElementById('age').innerHTML = "Age entered " + userAge + "is not in range. Can play not in youth team.";}
  27.  
  28. }
  29.  
  30. </script>
  31. </head>
  32.  
  33. <body>
  34.  
  35.  
  36. <header>
  37. <h1>Aaron Stockdale's Age Range Check</h1>
  38. </header>
  39.  
  40.  
  41.  
  42.  
  43. <section>
  44.  
  45. <br><p>This page will prompt Aaron for his age to check if he can play in the youth team.</p>
  46.  
  47. <h2>Click on the button below to enter Aaron's age</h2>
  48.  
  49. <p><input type="button" id="button1" style="border:2px solid #6A959D" value="Enter age and compare with AND operator"
  50. onclick="andFunction()"/>
  51.  
  52. <p><input type="button" id="button1" style="border:2px solid #6A959D" value="Enter age and compare with OR operator"
  53. onclick="orFunction()"/>
  54.  
  55. </section>
  56.  
  57.  
  58. </body>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement