Relógio em JavaScript em HTML

 
Simples relógio em JavaScript e HTML sendo exibito em tempo real.

 

<html><head>
<title>DWS Relógio – JavaScript e HTML</title>
<meta http-equiv=”content-type” content=”text/html; charset=ISO-8859-1″>

<script type=”text/javascript”>
function DWS_Relogio(){
DWS_Date = new Date;
DWS_Time = showFilled(DWS_Date.getHours()) + “:” + showFilled(DWS_Date.getMinutes()) + “:” + showFilled(DWS_Date.getSeconds());
document.getElementById(“dws”).innerHTML = DWS_Time;
setTimeout(“DWS_Relogio()”,1000);
}
function showFilled(Value) {
return (Value > 9) ? “” + Value : “0” + Value;
}
</script>
</head>

<body onload=”DWS_Relogio()”>

<font id=”dws” size=”7″ face=”Trebuchet MS, Verdana, Arial, sans-serif” color=”red”></font>

</body>
</html>

 

Ex.: