Luca
Messaggi : 8 Data d'iscrizione : 25.06.10
| Titolo: Codice mini orologio ora minuti secondi Ven Giu 25, 2010 4:13 am | |
| - Codice:
-
<script type="text/javascript"><!-- var timerID = null; var timerRunning = false; function StartClock (){
if(timerRunning) clearTimeout(timerID); timerRunning = false; showTime(); } function showTime (){ var adesso = new Date(); var ore = adesso.getHours(); var minuti = adesso.getMinutes(); var secondi = adesso.getSeconds(); var timeVal = "" + ore; timeVal += ((minuti < 10) ? ":0" : ":") + minuti; timeVal += ((secondi < 10) ? ":0" : ":") + secondi; document.orologio.tempo.value = timeVal; timerID = setTimeout("showTime()",1000); timerRunning = true; } //--></script> <body onload="StartClock()"> <form name="orologio" onsubmit="0">Sono le ore <input type="text" name="tempo" size="8"></form> | |
|