I have a basic time-clock script. I would like to have control over each digit. How would I add css to these variables? This is what I've tried.
window.onload = function startTime() {
var today=new Date();
var h=today.getHours();
h="<span id='hours'>"+h+"</span>";
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
m="<span id='minutes'>"+m+"</span>";
s=checkTime(s);
s="<span id='seconds'>"+s+"</span>";
document.getElementById("txt").innerHTML=h+"<span class='time-colon'>:"+"</span>"+m+"<span class='time-colon'>:"+"</span>"+s;
t=setTimeout(function(){startTime()},500);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}