/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!--By Shashikanth reddy nalabolu--> <!--Some logic has been used from other web source--> <html> <head> <title>(Type a title for your page here)</title> <script type="text/javascript"> function display_c(){ var refresh=1000; // Refresh rate in milli seconds mytime=setTimeout('display_ct()',refresh) } function display_ct() { var strcount //var x = new Date() var d=new Date(); var time=d.getHours(); //alert(time); var secondss=d.getSeconds(); //alert(secondss); var Mins=d.getMinutes(); if(time>12) { var s = "PM"; } else { var s = "AM"; } var x = time+" "+":"+" "+Mins+ " "+":"+" "+secondss+" "+s; document.getElementById('ct').innerHTML = x; tt=display_c(); } </script> </head> <body onload=display_ct();> <span id='ct' ></span> </body> </html>