ciao, il mio probblema è questo:
vorrei creare un file *.js con all'interno il codice per un orologio + datario
<script language="JavaScript" type="text/javascript">
//<![CDATA[
if (navigator.appName == "Microsoft Internet Explorer") {
ID = setTimeout("Aggiorn();",1000);
function Aggiorn() {
Mesi = new Array(11);
Mesi [0] = "Gennaio"
Mesi [1] = "Febbraio"
Mesi [2] = "Marzo"
Mesi [3] = "Aprile"
Mesi [4] = "Maggio"
Mesi [5] = "Giugno"
Mesi [6] = "Luglio"
Mesi [7] = "Agosto"
Mesi [8] = "Settembre"
Mesi [9] = "Ottobre"
Mesi [10] = "Novembre"
Mesi [11] = "Dicembre"
Data = new Date()
Giorno = Data.getDate()
Mese = Data.getMonth()
Anno = Data.getYear()
Datario = Data.toGMTString()
GiorSet = Datario.substring(0, 3)
if (GiorSet == "Sun") GiorSet = "Domenica"
if (GiorSet == "Mon") GiorSet = "Lunedì"
if (GiorSet == "Tue") GiorSet = "Martedì"
if (GiorSet == "Wed") GiorSet = "Mercoledì"
if (GiorSet == "Thu") GiorSet = "Giovedì"
if (GiorSet == "Fri") GiorSet = "Venerdì"
if (GiorSet == "Sat") GiorSet = "Sabato"
Ore = Data.getHours()
Minuti = Data.getMinutes()
Secondi = Data.getSeconds()
if ((Ore > 6) && (Ore < 13)) Saluto = "Buongiorno"
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
Cal = Saluto + ", sono le ore " + Ore + ":" + Minuti + "." + Secondi + " di " + GiorSet + ", " + Giorno + " " + Mesi[Mese] + " " + Anno
// document.FormData.Tes.value=Cal
ID = setTimeout("Aggiorn();",1000);
if (document.all)
document.all.clock.innerHTML=Cal
else
document.write(Orologio)
}
}
//]]>
<span style="font-size:18px;color:#FFFF00;font-family:Tahoma,Verdana,Arial;" id="clock"></span>
</script>
Logicamente devo togliere <script></script> (giusto?)
e quando richiamo lo script escono due errori:
uno è alla fine tra //]> e <span....
l'altro è "document.all.clock.innerHTML=Cal"
non so come fare per farlo funzionare, mi potete aiutare
ciao gigi