Hi All,
I'm attempting to retrieve month name from getMonths. My procedure enters getMoths() OK but my alert msg states my variables are undefined. Once I have month name, I need to pass it to my webpage. If anyone knows of an easier way of doing this, I'm interested for any suggestions.
Any help would be appreciated...
JavaScript code follows:
function setMonths(_form) {
var currDate = new Date();
var twoPriorMonths = currDate.getMonth()-1;
var myTwoMonths = getMonths(twoPriorMonths);
alert("myTwoMonths... " + myTwoMonths);
alert("twoPriorMonths... " + myTwoMonths);
}
function getMonths(_month) {
alert("In getMonths..."
;
switch(_month) {
case("1"
:
var myMonth = "January";
break;
case("2"
:
var myMonth = "February";
break;
case("3"
:
var myMonth = "March";
break;
case("4"
:
var myMonth = "April";
break;
case("5"
:
var myMonth = "May";
break;
case("6"
:
alert("HERE 1"
;
var myMonth = "June";
alert("In June... " + myMonth);
break;
case("7"
:
var myMonth = "July";
break;
case("8"
:
var myMonth = "August";
break;
case("9"
:
var myMonth = "September";
break;
case("10"
:
var myMonth = "October";
break;
case("11"
:
var myMonth = "November";
break;
case("12"
:
var myMonth = "December";
break;
}
}
I'm attempting to retrieve month name from getMonths. My procedure enters getMoths() OK but my alert msg states my variables are undefined. Once I have month name, I need to pass it to my webpage. If anyone knows of an easier way of doing this, I'm interested for any suggestions.
Any help would be appreciated...
JavaScript code follows:
function setMonths(_form) {
var currDate = new Date();
var twoPriorMonths = currDate.getMonth()-1;
var myTwoMonths = getMonths(twoPriorMonths);
alert("myTwoMonths... " + myTwoMonths);
alert("twoPriorMonths... " + myTwoMonths);
}
function getMonths(_month) {
alert("In getMonths..."
switch(_month) {
case("1"
var myMonth = "January";
break;
case("2"
var myMonth = "February";
break;
case("3"
var myMonth = "March";
break;
case("4"
var myMonth = "April";
break;
case("5"
var myMonth = "May";
break;
case("6"
alert("HERE 1"
var myMonth = "June";
alert("In June... " + myMonth);
break;
case("7"
var myMonth = "July";
break;
case("8"
var myMonth = "August";
break;
case("9"
var myMonth = "September";
break;
case("10"
var myMonth = "October";
break;
case("11"
var myMonth = "November";
break;
case("12"
var myMonth = "December";
break;
}
}