Im learning javascript, and I am struggling to get my case statement to work. The idea is that you enter any number between 1 - 7 in the form it will invoke a function and it will alert giving you the day of the week. The default is "not a valid day". It seems really simple but I thought I had done it right, I have a feeling its a variable problem......
function DayOfTheWeek()
var 1 = DayOfTheWeek;
var 2 = DayOfTheWeek;
var 3 = DayOfTheWeek;
var 4 = DayOfTheWeek;
var 5 = DayOfTheWeek;
var 6 = DayOfTheWeek;
var 7 = DayOfTheWeek;
switch (DayOfTheWeek){
case '1':
alert ("It's Monday");
break;
case 2:
alert ("It's Tuesday");
break;
case 3:
alert ("It's Wednsday");
break;
case 4:
alert ("It's Thursday");
break;
case 5:
alert ("It's Friday");
break;
case 6:
alert ("It's Saturday");
break;
case 7:
alert ("It's Sunday");
break;
default:
alert ("Not a valid day");
break;
}
DayOfTheWeek(), ignoring the unused (and impossible) numeric variables...