I assume you have something like:
<a href="#" onclick="cal.prevMonth(); return false;" class="Prev"> </a>
...
<script>
var Calendar = function() {
var month = ...;
var updateDisplay = function() {
...
};
return {
prevMonth: function() {
month--;
updateDisplay();
}
};
};
var cal = new Calendar();
</script>
Calendar
is a class with private members, cal
is an instance of that class.
All you should have to do is add a new member to Calendar
that tracks if your onclick
should be disabled, e.g. isDisabled
, and check for this in the function you call in your onclick
, e.g.
prevMonth: function() {
if (isDisabled) {
return;
}
month--;
updateDisplay();
}