The title says it all. The nextmon() and prevmon() functions are listed
afterward, since they call fDrawCal().I'm sure you see the
problem...prevmon() is not defined prior to being mentioned in the
onClick event. But what's the solution? Here's the structure that I
have now:
function fDrawCal(iMonth, iYear) {
var myMonth;
myMonth = fBuildCal(iYear, iMonth);
document.write('<table id="calendar" cellspacing="0" cellpadding="0"
summary="One month calendar">');
document.write('<caption><a onClick="prevmon()" title="previous month"
class="nav">« </a>'+ThisMonth+' '+iYear+'<a onClick"nextmon"
title="next month" class="nav"> »</a></caption>');
document.write(' <tr>');
...
etc.
...
}
function nextmon() {
iMonth = iMonth+1;
if (iMonth==13) {iYear=iYear+1; iMonth=1}
fDrawCal(iMonth, iYear);
}
function prevmon() {
iMonth = iMonth-1;
if (iMonth==0) {iYear=iYear-1; iMonth=12}
fDrawCal(iMonth, iYear);
}