RSS

Soft-S


Главная » Файлы » Мои файлы

Графические Часы-1
28.11.2009, 14:27
<body bgcolor="#FFFFFF" text="#000000">
<table border="1" cellpadding="0" cellspacing="4"
background="3ddgbck.gif" bgcolor="#000000">
    <tr>
        <td><p align="center">
<script language="JavaScript">
<!--
var digit = new Array()
digit[0] = new Image(16, 21)
digit[1] = new Image(16, 21)
digit[2] = new Image(16, 21)
digit[3] = new Image(16, 21)
digit[4] = new Image(16, 21)                   
digit[5] = new Image(16, 21)
digit[6] = new Image(16, 21)
digit[7] = new Image(16, 21)
digit[8] = new Image(16, 21)
digit[9] = new Image(16, 21)
digit[12] = new Image(9, 21) // colon
digit[13] = new Image(9, 21) // blank
for (var i = 0; i < 10; ++i) {
    digit[i].src = getPath(location.href) + "3ddg" + i + ".gif"
}
digit[12].src = getPath(location.href) + "3ddgc.gif"
digit[13].src = getPath(location.href) + "3ddgb.gif"
var hour1 = getHour(0)
var hour2 = getHour(1)
var minute1 = getMinute(0)
var minute2 = getMinute(1)
var colon = false
var start = document.images.length
var openImage = "<IMG SRC=\"" + getPath(location.href) + "3ddg"
var closeImage = ".gif\" HEIGHT=150 WIDTH=100>"
document.write(openImage + hour1 + closeImage)
document.write(openImage + hour2 + closeImage)
document.write(openImage + "c.gif\" HEIGHT=150 WIDTH=50>")
document.write(openImage + minute1 + closeImage)
document.write(openImage + minute2 + closeImage)
var timerID = null
var timerRunning = false
update()
function setClock() {
    if (getHour(0) != hour1) { // not getHours()!
        hour1 = getHour(0)
        document.images[start].src = digit[hour1].src
    }
    if (getHour(1) != hour2) { // not getHours()!
        hour2 = getHour(1)
        document.images[start + 1].src = digit[hour2].src
    }
    colon = !colon
    if (!colon)
        document.images[start + 2].src = digit[13].src
    else
        document.images[start + 2].src = digit[12].src
    if (getMinute(0) != minute1) { // not getMinutes()!
        minute1 = getMinute(0)
        document.images[start + 3].src = digit[minute1].src
    }
    if (getMinute(1) != minute2) { // not getMinutes()!
        minute2 = getMinute(1)
        document.images[start + 4].src = digit[minute2].src
    }
    timerID = setTimeout("setClock()",1000)
      timerRunning = true
}

function update() {
    stopClock()
    setClock()
}

function stopClock() {
if (timerRunning)
        clearTimeout(timerID)
timerRunning = false
}

function getHour(place) {
    var now = new Date()
    var hour = now.getHours()
    if (hour >= 24)
        hour =- 24
    hour = (hour == 0) ? 0 : hour
    if (hour < 10)
        hour = "0" + hour // do not parse number!
    hour += ""
    return parseInt(hour.charAt(place))
}

function getMinute(place) {
    var now = new Date()
    var minute = now.getMinutes()
    if (minute < 10)
        minute = "0" + minute // do not parse number!
    minute += ""
    return parseInt(minute.charAt(place))
}

function getPath(url) {
    lastSlash = url.lastIndexOf("/")
    return url.substring(0, lastSlash + 1)
}

// -->
</script>
</p>
        </td>
    </tr>
</table>
Категория: Мои файлы | Добавил: ModeratoR | Теги: Графические Часы-1
Просмотров: 469 | Загрузок: 0