Digital Clock
<head>
<STYLE>.clock {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: black; BORDER-BOTTOM: black 1px solid; FONT-FAMILY: verdana; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #a6a98d
}
.time {
FONT-SIZE: 50px
}
.clock TD {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; BORDER-COLLAPSE: collapse
}
B {
COLOR: black
}
BODY {
FONT-SIZE: 10pt; FONT-FAMILY: arial
}
</STYLE>

<SCRIPT language=JavaScript>
function time() {
var today = new Date();
var hrs = today.getHours();
var min = today.getMinutes();
var secs = today.getSeconds();
var alsohrs = today.getHours();
var dayNumber = today.getDate();
var year = today.getFullYear();
var ampm="";
var zero="0";
var month = today.getMonth() +1;
var weekday = today.getDay();
var wdn = new Array(7)
wdn[0] = "SUN";
wdn[1] = "MON";
wdn[2] = "TUE";
wdn[3] = "WED";
wdn[4] = "THU";
wdn[5] = "FRI";
wdn[6] = "SAT";
//Statement that puts '0's in front of single minutes or seconds.
if (min<10)
{
min=zero+min;
}
if (secs<10)
{
secs=zero+secs;
}
//Statement that eliminates Metric Time
if (hrs>12)
{
hrs=eval(hrs - 12);
}
if (hrs>=0 && hrs<1)
{
hrs=12
}
//P.M. Statement
if (alsohrs>=12 && alsohrs<24)
{
ampm="P.M.";
}
//A.M. Statement
if (alsohrs<12 && alsohrs>=0)
{
ampm="A.M.";
}
tmp='<table width="20%" class="clock"><tr><td class="time" colspan="4">';
tmp+=hrs+'<span id="blinker">:</span>'+min;
tmp+='<font size="5"> '+ampm+'</font>';
tmp+='<tr><td><font size="-1">Month</font><br><b>'+month+'</b></td>';
tmp+='<td><font size="-1">Date</font><br><b>'+dayNumber+'</b></td>';
tmp+='<td><font size="-1">Day</font><br><b>'+wdn[weekday]+'</b></td>';
tmp+='<td><font size="-1">Year</font><br><b>'+year+'</b></td></tr></table>';
document.getElementById("clockgoeshere").innerHTML=tmp;
clocktime=setTimeout("time()","1000");
}
function blink() {
var obj = document.getElementById("blinker");
if (obj.style.visibility == "visible") {
obj.style.visibility="hidden";
}
else {
obj.style.visibility="visible";
}
eachsecond=setTimeout("blink()","500");
}
</SCRIPT>
</head>
<body onload="time(); blink();" >
<DIV id=clockgoeshere></DIV>
</body>




Демо



/ Трябва да сте регистриран за да напишете коментар /