I coded these two functions that supplies the data on my calendar form. It works fine, but on random occassion I get an error message "months[...]is null or not an object" on line 8 of function drawCal(form), and sometimes I get an "undefined" on the "form.yearBox.value" line 13 of function drawCal(form). Am I missing anything on my function drawselection(form) that passes values to function drawCal(form)?
Any help will be greatly appreciated.....
Thanks!
function drawCal(form)
{
makeMonthArray()
var theYear=form.frmYear.value
var monthIndex=form.frmMonth.value + 1
if (monthIndex == 2)
months[monthIndex].length = getNumFebDays(theYear);
var firstMonthDay = months[monthIndex].getFirstMonthDay(theYear)
var numMonthDays = months[monthIndex].length
var monthName = months[monthIndex].name
form.monthBox.value = monthName
form.yearBox.value = form.frmYear.value
for (var i = 0; i < 42; i++)
if (i < firstMonthDay || i >= (numMonthDays + firstMonthDay))
form.dayBox.value = ""
else
form.dayBox.value = i - firstMonthDay + 1
}
function drawSelection(form)
{
for (var x = 0; x < 3; x++)
{if (form.frmYear[x].checked)
break;}
form.frmYear.value=x
if (x == 0)
form.frmYear.value=1999;
if (x == 1)
form.frmYear.value=2000;
if (x == 2)
form.frmYear.value=2001;
for (var i = 0; i < 12; i++)
{if (form.frmMonth.checked)
break;}
form.frmMonth.value=i
drawCal(form)
}
Any help will be greatly appreciated.....
Thanks!
function drawCal(form)
{
makeMonthArray()
var theYear=form.frmYear.value
var monthIndex=form.frmMonth.value + 1
if (monthIndex == 2)
months[monthIndex].length = getNumFebDays(theYear);
var firstMonthDay = months[monthIndex].getFirstMonthDay(theYear)
var numMonthDays = months[monthIndex].length
var monthName = months[monthIndex].name
form.monthBox.value = monthName
form.yearBox.value = form.frmYear.value
for (var i = 0; i < 42; i++)
if (i < firstMonthDay || i >= (numMonthDays + firstMonthDay))
form.dayBox.value = ""
else
form.dayBox.value = i - firstMonthDay + 1
}
function drawSelection(form)
{
for (var x = 0; x < 3; x++)
{if (form.frmYear[x].checked)
break;}
form.frmYear.value=x
if (x == 0)
form.frmYear.value=1999;
if (x == 1)
form.frmYear.value=2000;
if (x == 2)
form.frmYear.value=2001;
for (var i = 0; i < 12; i++)
{if (form.frmMonth.checked)
break;}
form.frmMonth.value=i
drawCal(form)
}