How to make a clock using javascript

How to make a clock using javascript

A few lines of javascript is required to make a clock. It shows the local time( the time that is displayed in your Computer).

Javascript Code

<script type="text/javascript">
function ShowTime(ctrl)
  var time=new Date();
  var h=time.getHours();
  var m=time.getMinutes();
  var s=time.getSeconds();
  // add a zero in front of numbers<10
  var obj = document.getElementById(ctrl);
  obj.innerHTML=h+" : "+m+" : "+s;
  setTimeout('ShowTime(\"' + ctrl +'\",true)',1000);
function checkTime(i)
  if (i<10) 
    i="0" + i;
  return i;

"jsClk" is the id of a <label> tag which is located inside <body> tag.

1 Responses to "How to make a clock using javascript"

  1. ICZSCW <a href="">eevtualhdakw</a>, [url=]akiozjnkefva[/url], [link=]idlylzdczxfj[/link],

Leave a Reply