On Tue, Jan 19, 2010 at 2:29 PM, parot <russ...@parotkefalonia.com> wrote: > so you could have something like > > $("button#prevMonth").click(function() { > loadMonth(--currentMonth),loadYear(--currentYear); });
Well, to handle year and month you'll want something like: var currentMonth = 1; var currentYear = 2010; function deltaMonth(delta) { currentMonth += delta; while (currentMonth < 1) { --currentYear; currentMonth += 12; } while (currentMonth > 12) { ++currentYear; currentMonth -= 12; } }