Well, of course you would need all of your various numbers as images, gif would probably be best. You would need them for 0 through 9 (ex: 5.gif). And you would need a colon.gif image, and one AM.gif, one PM.gif, and images for the days of the week (ex: Mon.gif). Put all of the images in the same folder as the page.
To output the image tags for the time numbers, a helper function would be good:
Code:
var num2image = function(n){
n = n.toString(10);
if (n.length == 1)
return '<img src="' + n + '.gif">';
return '<img src="' + n.charAt(0) + '.gif"><img src="' + n.charAt(1) + '.gif">';
};
and a variable for the oft repeated colon:
Code:
var cln = '<img src="colon.gif">';
These can both go at the very end of the script. Now we can use them as we edit this line:
Code:
this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")"
Replace it with these:
Code:
this.container.innerHTML = num2image(formatField(hour, 1)) + cln + num2image(formatField(minutes)) + cln +
num2image(formatField(seconds)) + '<img src="' + ampm + '.gif">' + '<img src="' + dayofweek + '.gif">';
Just make sure to follow all of that, and to use the "short" parameter for the displaymode in the script call, ex:
Code:
<script type="text/javascript">
new showLocalTime("timecontainer", "server-ssi", 0, "short
")
</script>
and you should be all set.
Bookmarks