HELP: Conditional Statement

0 Mike Higgins · June 10, 2014
1.) I need to modify an existing  code I have file titled: "club.html" to display an alert if the user is under 21 year of age.
2.) Next display an alert box if the user is over 21 years old letting them know they are too old to enter the club.
3.) Finally, if the user is exactly 21 have an alert box saying, â??Welcome to our exclusive club, blah blah blahâ??.
4.) After the alert it should automatically take them to a new page/URL of a site I created.

So what I have thus far is as follows:



var age = parseInt(prompt("Please enter your age:", age))

if (age < 21)
alert("Sorry, you are too young to enter")

else
{
alert("Welcome, you are old enough!");
}



As you can see I have steps 1 and 3 only...

Post a Reply

Replies

Oldest  Newest  Rating
0 Mike Higgins · June 11, 2014
Yeah?, be seeing you back here soon then LoL..
Seriously,, thanks MUCH!!
0 Mike Higgins · June 11, 2014
Wheately,

Thank you again for your help - your knowledge is much appreciated and very useful to me as a beginning coder.

0 Mike Higgins · June 10, 2014
Almost, only thing left to do is if someone enters an age that is over 21 it should alert as

alert("Sorry, you exceed the age of 21!");


Or something along that line/Message.
0 Mike Higgins · June 10, 2014
Problem is I need all 4 steps, but as s you can see I have steps 1 and 3 only...
  • 1

Javascript

107,281 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators