Forum Discussion
NeilServices
7 years agoQrew Member
You could just change this statement:
nextMonth += 1;
To
nextMonth = nextMonth == 12 ? 1 : nextMonth + 1;
and change the loop control from:
for(var i = 0; i <= numMonths - 1 && nextMonth < 13; i++){
To:
for(var i = 0; i <= numMonths - 1 ; i++){
If you're just learning I found the following resources useful:
https://stackoverflow.com/ - you can ask/search for answers to programming questions
https://developer.mozilla.org/en-US/docs/Web/javascript - for tutorials and specs
Neil
nextMonth += 1;
To
nextMonth = nextMonth == 12 ? 1 : nextMonth + 1;
and change the loop control from:
for(var i = 0; i <= numMonths - 1 && nextMonth < 13; i++){
To:
for(var i = 0; i <= numMonths - 1 ; i++){
If you're just learning I found the following resources useful:
https://stackoverflow.com/ - you can ask/search for answers to programming questions
https://developer.mozilla.org/en-US/docs/Web/javascript - for tutorials and specs
Neil
- WilliamEvans17 years agoQrew CadetWow that's fantastic Neil, thanks so much
I just implemented it, and the button works perfectly now! Thanks!