Zegar cyfrowy


Po kliknięciu nastąpi powrót do strony głównej skryptów.



Klasyczny zegar cyfrowy. Można jego kształt i kolorystykę formatować poprzez zmianę ustawień w stylach.

0
1
2
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
0
1
2
3
4
5
6
7
8
9
:
:





Do zamieszczenia w ramach HEAD:

<STYLE TYPE="text/css">
<!--
.clock
{
position:absolute;
top: 100px;
width:80pt;
font-family: Times New Roman;
font-size:80px;
color:navy;
visibility:hidden;
}
// -->
</style>
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- -->
<!-- JavaScript Example, freeware -->
<!-- -->
<!-- Copyright (c) 1997,98 by Wojciech Wysznacki -->
<!-- E-mail: woytek@polbox.com -->
<!-- WWW : http://www.polbox.com/w/woytek -->
<!-- -->
<!--
timerRunning = null
first=1
var hour1, hour2, minute1, minute2, second1, second2;
function clock()
{
ohour1 = hour1
ohour2 = hour2
ominute1 = minute1
ominute2 = minute2
osecond1 = second1
osecond2 = second2
if(++second2 > 9) { second2=0
if(++second1 >5) { second1=0
if(++minute2 > 9) { minute1=0
if(++minute2 > 5) { minute2=0
if(++hour2 > 9) { hour2=0
if(++hour1 > 2) { hour1 =0 }
}
}
}
}
}
if(document.layers) var w=innerWidth/2-185
else var w=document.body.offsetWidth/2-185
if (ohour1 != hour1 || first) {
if(document.layers) {
document.layers["z0"+ohour1].visibility="hidden"
document.layers["z0"+hour1].left=w
document.layers["z0"+hour1].visibility="visible"
}
else {
document.all["z0"+ohour1].style.visibility="hidden"
document.all["z0"+hour1].style.left=w
document.all["z0"+hour1].style.visibility="visible"
}
}
if (ohour2 != hour2 || first) {
if(document.layers) {
document.layers["z1"+ohour2].visibility="hidden"
document.layers["z1"+hour2].left=w+44
document.layers["z1"+hour2].visibility="visible"
}
else {
document.all["z1"+ohour2].style.visibility="hidden"
document.all["z1"+hour2].style.left=w+44
document.all["z1"+hour2].style.visibility="visible"
}
}
if (ominute1 != minute1 || first) {
if(document.layers) {
document.layers["z2"+ominute1].visibility="hidden"
document.layers["z2"+minute1].left=w+117
document.layers["z2"+minute1].visibility="visible"
}
else {
document.all["z2"+ominute1].style.visibility="hidden"
document.all["z2"+minute1].style.left=w+117
document.all["z2"+minute1].style.visibility="visible"
}
}
if (ominute2 != minute2 || first) {
if(document.layers) {
document.layers["z3"+ominute2].visibility="hidden"
document.layers["z3"+minute2].left=w+161
document.layers["z3"+minute2].visibility="visible"
}
else {
document.all["z3"+ominute2].style.visibility="hidden"
document.all["z3"+minute2].style.left=w+161
document.all["z3"+minute2].style.visibility="visible"
}
}
if (osecond1 != second1 || first) {
if(document.layers) {
document.layers["z4"+osecond1].visibility="hidden"
document.layers["z4"+second1].left=w+234
document.layers["z4"+second1].visibility="visible"
}
else {
document.all["z4"+osecond1].style.visibility="hidden"
document.all["z4"+second1].style.left=w+234
document.all["z4"+second1].style.visibility="visible"
}
}
if(document.layers) {
document.layers["z5"+osecond2].visibility="hidden"
document.layers["z5"+second2].left=w+278
document.layers["z5"+second2].visibility="visible"
}
else {
document.all["z5"+osecond2].style.visibility="hidden"
document.all["z5"+second2].style.left=w+278
document.all["z5"+second2].style.visibility="visible"
}
if (first) {
if(document.layers) {
document.z1.left= w+88;
document.z1.top = 94;
document.z1.visibility = "visible"
document.z2.left= w+205;
document.z2.top = 94;
document.z2.visibility = "visible"
}
else {
z1.style.left= w+88;
z1.style.top = 94;
z1.style.visibility = "visible"
z2.style.left= w+205;
z2.style.top = 94;
z2.style.visibility = "visible"
}
}
first = 0
timerID = setTimeout("clock()",1000)
}
function start()
{
var now = new Date()
var hour = now.getHours()
var minute = now.getMinutes()
var sec = now.getSeconds()
if (hour < 10) hour = "0" + hour
hour += ""
hour1 = parseInt(hour.charAt(0))
hour2 = parseInt(hour.charAt(1))
if (minute < 10) minute = "0" + minute
minute += ""
minute1 = parseInt(minute.charAt(0))
minute2 = parseInt(minute.charAt(1))
if (sec < 10) sec = "0" + sec
sec += ""
second1 = parseInt(sec.charAt(0))
second2 = parseInt(sec.charAt(1))
clock()
}
// -->
</SCRIPT>


Do umieszczenia w dowolnym miejscu:

<SCRIPT LANGUAGE="JavaScript1.2">
<!--
if(timerRunning) clearTimeout(timerID)
timerRunning = false
timerID = setTimeout("start()",0)
// -->
</SCRIPT>
<div id="z00" class='clock'>0</div>
<div id="z01" class='clock'>1</div>
<div id="z02" class='clock'>2</div>
<div id="z10" class='clock'>0</div>
<div id="z11" class='clock'>1</div>
<div id="z12" class='clock'>2</div>
<div id="z13" class='clock'>3</div>
<div id="z14" class='clock'>4</div>
<div id="z15" class='clock'>5</div>
<div id="z16" class='clock'>6</div>
<div id="z17" class='clock'>7</div>
<div id="z18" class='clock'>8</div>
<div id="z19" class='clock'>9</div>
<div id="z20" class='clock'>0</div>
<div id="z21" class='clock'>1</div>
<div id="z22" class='clock'>2</div>
<div id="z23" class='clock'>3</div>
<div id="z24" class='clock'>4</div>
<div id="z25" class='clock'>5</div>
<div id="z30" class='clock'>0</div>
<div id="z31" class='clock'>1</div>
<div id="z32" class='clock'>2</div>
<div id="z33" class='clock'>3</div>
<div id="z34" class='clock'>4</div>
<div id="z35" class='clock'>5</div>
<div id="z36" class='clock'>6</div>
<div id="z37" class='clock'>7</div>
<div id="z38" class='clock'>8</div>
<div id="z39" class='clock'>9</div>
<div id="z40" class='clock'>0</div>
<div id="z41" class='clock'>1</div>
<div id="z42" class='clock'>2</div>
<div id="z43" class='clock'>3</div>
<div id="z44" class='clock'>4</div>
<div id="z45" class='clock'>5</div>
<div id="z50" class='clock'>0</div>
<div id="z51" class='clock'>1</div>
<div id="z52" class='clock'>2</div>
<div id="z53" class='clock'>3</div>
<div id="z54" class='clock'>4</div>
<div id="z55" class='clock'>5</div>
<div id="z56" class='clock'>6</div>
<div id="z57" class='clock'>7</div>
<div id="z58" class='clock'>8</div>
<div id="z59" class='clock'>9</div>
<div id="z1" class='clock'>:</div>
<div id="z2" class='clock'>:</div>




Skrypt do pobrania:

Po kliknięciu nastąpi transfer archiwum z plikiem tekstowym ze skryptem