Ciao a tutti,
qualcuno sa dirmi come posso far funzionare una funzione data/ora in javascript in modo che venga visualizzata correttamente in tutti i browser?
a me in IE: Oggi è il 20 Marzo 2008
in Firefox: Oggi è il 20 Marzo 108
Ciao e grazie in anticipo.
Qui sotto allego il codice javascript che ho inserito in un file esterno (.css) e che richiamo nella mia pagina html tramite la tag <a href....
<!-- Hide from browsers that do not support JavaScript
// Get the current date
today = new Date();
// Get the current month
month = today.getMonth();
// Attach a display name to the month number
switch (month) {
case 0 :
displayMonth = "Gennaio"
break
case 1 :
displayMonth = "Febbraio"
break
case 2 :
displayMonth = "Marzo"
break
case 3 :
displayMonth = "Aprile"
break
case 4 :
displayMonth = "Maggio"
break
case 5 :
displayMonth = "Giugno"
break
case 6 :
displayMonth = "Luglio"
break
case 7 :
displayMonth = "Agosto"
break
case 8 :
displayMonth = "Settembre"
break
case 9 :
displayMonth = "Ottobre"
break
case 10 :
displayMonth = "Novembre"
break
case 11 :
displayMonth = "Dicembre"
break
default: displayMonth = "INVALID"
}
document.writeln ("Oggi è il " + today.getDate() + " " + displayMonth + " " + today.getYear());
// -->