function aggiorna() { var mesi = new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"); var nomeGiorno = new Array('Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato'); Data = new Date() Giorno = Data.getDate() Mese = Data.getMonth() Anno = Data.getFullYear() Ore = Data.getHours() Minuti = Data.getMinutes() Secondi = Data.getSeconds() if ((Ore > 6) && (Ore < 13)) Saluto = "Buon giorno" if ((Ore > 12) && (Ore < 18)) Saluto = "Buon pomeriggio" if ((Ore > 17) && (Ore < 22)) Saluto = "Buona sera" if (Ore > 21) Saluto = "Buona notte" if (Ore < 7) Saluto = "Buona notte" if (Minuti < 10) Minuti = "0" + Minuti if (Secondi < 10) Secondi = "0" + Secondi messaggio = Saluto + ", sono le ore " + Ore + ":" + Minuti + "." + Secondi + " di " + nomeGiorno[Data.getDay()] + ", " + Giorno + " " + mesi[Mese] + " " + Anno if(!document.layers){ aggsec = setTimeout("aggiorna();",1000);} if (document.getElementById){ document.getElementById('clock').innerHTML=messaggio;} else if (document.all){ document.all.clock.innerHTML=messaggio;} else if(document.layers){ document.write(messaggio);} } aggiorna();