2
am a beginner in Javascript.
I need to make a calendar that shows only the months.
For example:
It is September now. The calendar will show from September(2016) to August(2017).
With the code below, I can print the months from January to December. But I need him to show you from the present month to 12 months ahead. Can you help me?
window.onload = function calendar() {
var a = new Date();
var b = a.getMonth();
var months = [
"Janeiro",
"Fevereiro",
"Março",
"Abril",
"Maio",
"Junho",
"Julho",
"Agosto",
"Setembro",
"Outubro",
"Novembro",
"Dezembro"
];
var i = months[i];
for (i = 0; i <= 11; i++) {
document.getElementsByClassName("month-time")[i].innerHTML = months[i];
}
}
I only saw now these two unnecessary variables at the beginning of the function.
– rbenvenuto