Orologio con le 24 ore

Postato il: 5 aprile 2009 | Nella categoria: JavaScript » Script

Per visualizzare un orologio digitale che segnala le ore, i minuti e i secondi, bisogna inserire il seguente script e poi style CSS all’interno dei tag head:

<SCRIPT type="text/javascript">
<!-- Prelevato su: http://www.ladispensa.altervista.org -->
function showFilled(Value) {
return (Value > 9) ? "" + Value : "0" + Value;
}
function StartClock24() {
TheTime = new Date;
document.clock.showTime.value = showFilled(TheTime.getHours()) + ":" + showFilled(TheTime.getMinutes()) + ":" + showFilled(TheTime.getSeconds());
setTimeout("StartClock24()",1000)
}
//-->
</script>
 
<style type="text/css">
<!--
.input { border-style: none;
font-family: Comic Sans MS;
font-size: 10 px;
color : red;
}
-->
</style>

Successivamente sostituisci l’apertura del tag body con questa stringa:

<body bgcolor="#FFFFFF" onLoad="StartClock24()">

Ed infine, all’interno dei tag body, inseriamo il form con l’orologio 24h:

<form name=clock>
<input type=text name=showTime size=8 class=input>
</form>

Articoli simili:

Sono stati inviati 0 commenti - Invia un commento

Lascia un commento