PDA

View Full Version : [DHTML] Basic Clock



neelchauhan
04-23-2008, 12:44 PM
1) CODE TITLE: Basic Clock

2) AUTHOR NAME/NOTES:Windows Universe

3) DESCRIPTION: This is a very small clock that shows your local time and it does not use AJAX or PHP to fetch the time.

4) CODE:

<script>

var clockID = 0;

function updateclock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}

var tDate = new Date();

document.getElementById('TheTime').innerHTML = ""
+ tDate.getHours() + ":"
+ tDate.getMinutes() + ":"
+ tDate.getSeconds();

clockID = setTimeout("updateclock()", 1000);
}
function StartClock() {
clockID = setTimeout("updateclock()", 500);
}


StartClock()</script>
<h1 style="background-color: blue; color: white; width: 120px; height: 40px; font-family: arial;" id="TheTime"></h1>

Nile
04-23-2008, 03:16 PM
Its not a bad start. But maybe this should be a bit different. What if you tried making it in the form of a real clock? That'd be better. ;)

neelchauhan
04-23-2008, 05:17 PM
This is a digital clock rendered by DHTML, not a regular clock.
http://nexus404.com/Blog/wp-content/uploads/2007/04/round-led-animated-digital-clock.jpg

Nile
04-23-2008, 05:38 PM
Yea, well try to make that. ;)