DHTML Digital Clock
Thursday, October 19th, 2006I saw a spam article on Digg the other day about adding a clock to your webpage – the clocks in question were coded in Flash, and although looked nice, seemed to be rather heavyweight for what they do. This gave me the idea to construct my own digital clock using pure DHTML, as a nice complement to the analogue clock of a few months ago.
This clock consists of a pretty small javascript file, a minimal stylesheet and three images (a horizontal bar, a vertical bar and an animated gif for the flashing dots separating the hours, minutes and seconds). These images can be modified to include anti-aliasing, change of colours, or change of size (although a change of size will require adjustments to the stylesheet).
- Tested in:
- IE6
- IE7
- Firefox 2
- Netscape 8
- Valid XHTML
Source code is available below – feel free to use on your website.
