Javascript Clock (Time)
Javascript Clock (Time)
A very simple clock using javascript. Just paste the below code and the clock will be displayed inside the div area with the id as ‘time’, We are creating an instance named TheTime = new Date; and from that we can get all values like TheTime.getHours(),TheTime.getMinutes() and TheTime.getSeconds()
Just copy the below javascript. Also refer Javascript Clock with Date Time
Oepn an HTML file and PASTE THE FOLLOWING CODE
<SCRIPT LANGUAGE="JavaScript"> function showFilled(Value) { if(Value>9) { return Value; } else{ return '0'+Value; } } function StartClock24() { TheTime = new Date; document.getElementById('time').innerHTML = 'The Time Is: <b>'+showFilled(TheTime.getHours()) + ":" + showFilled(TheTime.getMinutes()) + ":" + showFilled(TheTime.getSeconds()); setTimeout("StartClock24()",1000) } //–> </script> <body onload= "StartClock24()" > <div id='time'></div>Javascript Clock (Time),
Incoming search terms:
- JavaScript Clock (2)