User:Amit6/JS clock 01.html.css

  function startTime { var today=new Date; var h=today.getHours; var m=today.getMinutes; var s=today.getSeconds; var ms=today.getMilliseconds; // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); ms=checkTimems(ms); v01=Math.round(255-ms*.255); v02=Math.round(ms*.255); v2_1=Math.round(127.5+Math.sin(ms/1000*Math.PI*2)*127.5); v2_1i=255-v2_1; v2_2=Math.round(127.5+Math.sin(s/60*Math.PI*2)*127.5); v2_2i=255-v2_2; document.getElementById('txt').style.backgroundColor='rgb('+v01+', '+128+', '+v02+')'; document.getElementById('txt').innerHTML=h+':'+m+':'+s+':'+ms; document.getElementById('t1').style.backgroundColor='rgb('+v2_1+', '+0+', '+v2_1i+')'; document.getElementById('t2').style.backgroundColor='rgb('+v2_2+', '+v2_2i+', '+0+')'; t=setTimeout('startTime',0); } function checkTimems(i) { if (i<100) { i='0' + i;  } if (i<10) { i='0' + i;  } return i; } function checkTime(i) { if (i<10) { i='0' + i;  } return i; }  a a