Sintesi, cribbio!
codice:
var aMonths = ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"];
function increaseMonth(nDelta) {
var oDisplay = document.getElementById("mese"), nThisMonth = aMonths.indexOf(oDisplay.value);
if (nThisMonth > -1) { oDisplay.value = aMonths[(nThisMonth + nDelta + 24) % 12]; }
}
function getMonthName(nMonth) {
return aMonths[nMonth - 1];
}
function getMonthNumber(sMonth) {
return aMonths.indexOf(sMonth) + 1;
}
function Numero() {
alert(getMonthNumber(document.getElementById("mese").value));
}
codice:
<form id="form1" method="post">
<input type="text" id="mese" />
+
-
Numero attuale
</form>