Skip to main content

Posts

Showing posts with the label clock

Client Clock by javascript

Client Clock by javascript Place the code below the head tag <script language="Javascript" type="text/javascript"> setInterval("settime()", 1000); function settime () {   var curtime = new Date();   var curhour = curtime.getHours();   var curmin = curtime.getMinutes();   var cursec = curtime.getSeconds();   var time = "";   if(curhour == 0) curhour = 12;   time = (curhour > 12 ? curhour - 12 : curhour) + ":" +          (curmin < 10 ? "0" : "") + curmin + ":" +          (cursec < 10 ? "0" : "") + cursec + " " +          (curhour > 12 ? "PM" : "AM");      document.getElementById('clock').value =time;   //document.getElementById('sample').value=time;   document.getElementById('mydiv').innerHTML  ="<h3>"+time+"</h3>";   } </script> place the code below the bod...