Monday, August 27, 2012

Displaying Dynamic Clock on the Website


<head>
<!--Simply copy and paste it where you wish it to appear.-->

<script language="Javascript1.2">
<!--
//Visit http://myhtmlquestionbank.blogspot.com for this script

if(navigator.appName == "Netscape") {
document.write('<layer id="clock"></layer><br>');
}

if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<span id="clock"></span><br>');
}

function upclock(){
var dte = new Date();
var hrs = dte.getHours();
var min = dte.getMinutes();
var sec = dte.getSeconds();
var col = ":";
var spc = " ";
var apm;

if (12 < hrs) {
apm="PM";
hrs-=12;
}

else {
apm="AM";
}

if (hrs == 0) hrs=12;
if (min<=9) min="0"+min;
if (sec<=9) sec="0"+sec;

if(navigator.appName == "Netscape") {
document.clock.document.write(hrs+col+min+col+sec+spc+apm);
document.clock.document.close();
}

if (navigator.appVersion.indexOf("MSIE") != -1){
clock.innerHTML = hrs+col+min+col+sec+spc+apm;
}
}

setInterval("upclock()",1000);
//-->
</script>

<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://myjavaquestionbank.blogspot.in">Techno Inida</a></font></p>



   <style type="text/css"><!--
     body {scrollbar-3dlight-color:;
                scrollbar-arrow-color:;
                scrollbar-track-color: ;
                scrollbar-darkshadow-color:;
                scrollbar-face-color:;
                scrollbar-highlight-color:;
                scrollbar-shadow-color:}
   --></style>

  </head>

No comments:

Post a Comment