I have 2 month (monthNow, monthLater) and 2 year (yearNow, yearLater) selects. When a user selects a month from monthNow, monthLater needs to increase by 1. The same goes for yearNow and yearLater. eg If a user selects the 2nd month in monthNow, the monthLater select needs to be the 3rd month and so on. This becomes a problem when it comes to the 12th month as the year then also has to change.
I need to be able to select the next value in getFullYear. For example I have the code below, which simply fills a select with the full year from now to 2011.
So if the year selected index is currently 2009, when a user selects the 12th month I need it to change the year to 2010 and so on.
Basically I just need to know how to select the next value in getFullYear. Any ideas? I hope this make sense.
var d = new Date();
currYear = d.getFullYear();
for(i = 0; i < 3; i++)
document.getElementById('searchAir.segments.departDate.year').options[i] = new Option(currYear+i,currYear+i);