Come si fa a inserire in una pagina web la data corrente (ed eventualmente anche l'ora), che si aggiorni automaticamente?
Ringrazio chiunque per una risposta.
Grazie
Sonia
Come si fa a inserire in una pagina web la data corrente (ed eventualmente anche l'ora), che si aggiorni automaticamente?
Ringrazio chiunque per una risposta.
Grazie
Sonia
Prova a guardare qui. Se cerchi con Google ne troverai molti altri.
Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
«Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen
Ti ringrazio molto, è proprio quello che mi serve. Avevo cercato "data" con Google, ma mi usciva tutto altro
Ciao
Sonia
Salve,
visto che siamo in tema,ho inserito qui uno script per la data,usando questo codice:
Però non riesco a farlo diventare della stessa misura e font delle parole a sinistra,cosa dovrei fare?<script type="text/javascript" language="JavaScript">
<!-- Original: Andrea Bianchi -->
<!-- Web Site: http://www.web-link.it -->
function WebDate() {
var now = new Date();
var year= now.getYear();if (year < 1000) year += 1900;
nameDay = new Array('DOMENICA','LUNEDI','MARTEDI','MERCOLEDI','G IOVEDI','VENERDI','SABATO');
nameMth = new Array('GENNAIO','FEBBRAIO','MARZO','APRILE','MAGGI O', 'GIUGNO', 'LUGLIO', 'AGOSTO', 'SETTEMBRE', 'OTTOBRE', 'NOVEMBRE','DICEMBRE');
document.write('<span style=\"color: white; font size:7pt;-weight : bold;\"> '+nameDay[now.getDay()]+ ' ' + now.getDate() + " " + nameMth[now.getMonth()] + " " + year+'</p>');
}
</script><!-- prelevato su http://www.web-link.it -->
Hai dimenticato font prima di -weight.Originalmente inviato da PSW
Per scrivere con lo stesso stile basta che cambi quello che c'è dentro al parametro style in modo che sia identico a quello che usi a destra.
Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
«Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen
Potresti scrivermelo?
Dove c'è font-size prova ad aggiustarlo tu il valore.Codice HTML:<script type="text/javascript" language="JavaScript"> <!-- Original: Andrea Bianchi --> <!-- Web Site: [url]http://www.web-link.it[/url] --> function WebDate() { var now = new Date(); var year= now.getYear();if (year < 1000) year += 1900; nameDay = new Array('DOMENICA','LUNEDI','MARTEDI','MERCOLEDI','G IOVEDI','VENERDI','SABATO'); nameMth = new Array('GENNAIO','FEBBRAIO','MARZO','APRILE','MAGGI O', 'GIUGNO', 'LUGLIO', 'AGOSTO', 'SETTEMBRE', 'OTTOBRE', 'NOVEMBRE','DICEMBRE'); document.write('<span style=\"font-family: Verdana; color: rgb(255, 255, 255); font-weight: bold; font-size:10pt;\"> '+nameDay[now.getDay()]+ ' ' + now.getDate() + " " + nameMth[now.getMonth()] + " " + year+'</span>'); } </script><!-- prelevato su [url]http://www.web-link.it[/url] -->
Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
«Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen
Oppure puoi usare Vbscript (interpretato sl da IE):
Codice HTML:<script language="VBScript"> document.write "Oggi è il " & Date() & "<br>" document.write "Sono le ore " & Time() & "<br>" </script>
Grazie ad entrambi.
Probid,riguardo lo script che hai scritto,c'è la possibilità di far cambiare l'ora senza dover aggiornare sempre la pagina?
Io ho modificato il tuo:Originalmente inviato da PSW
Non l'ho provato, non sono sicuro che funzioni.Codice:<script type="text/javascript" language="JavaScript"> function WebDate() { document.write('<span style=\"font-family: Verdana; color: rgb(255, 255, 255); font-weight: bold; font-size:10pt;\" id=\"dataora\"></span>'); DataOra(); } function DataOra() { var now = new Date(); var year= now.getYear(); if (year < 1000) year += 1900; nameDay = new Array('DOMENICA','LUNEDI','MARTEDI','MERCOLEDI','GIOVEDI','VENERDI','SABATO'); nameMth = new Array('GENNAIO','FEBBRAIO','MARZO','APRILE','MAGGIO', 'GIUGNO', 'LUGLIO', 'AGOSTO', 'SETTEMBRE', 'OTTOBRE', 'NOVEMBRE','DICEMBRE'); document.getElementById("dataora").innerHTML=" "+nameDay[now.getDay()]+ " " + now.getDate() + " " + nameMth[now.getMonth()] + " " + year + " " + now.getHour() + ":" + now.getMinutes() + ":" + now.getSeconds(); setTimeOut("DataOra()",1000); } </script>
Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
«Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen