test
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • gray Friend
    #155864

    Long time ago I wanted to add a clock (showing server time) near the current date. I did it today, in any case I hope so 🙂

    Already works on a live site (look at the top left coner).

    —–
    File: ja_teline_iii_v2blocksheader.php

    AFTER first[PHP]?>[/PHP]
    INSERT[PHP]<script type=”text/javascript” language=”JavaScript”>
    severtime = new Date( <?php echo date(‘Y,n,j,G,’,time()) . intval(date(‘i’,time())) . ‘,’ . intval(date(‘s’,time())); ?> );
    clocktime = 0;
    $(window).addEvent(‘load’, setInterval(function(){
    if (clocktime == 0) {
    clocktime = severtime;
    } else {
    clocktime = new Date(clocktime.getTime() + 1000);
    }
    var hours = clocktime.getHours();
    var minutes = clocktime.getMinutes();
    var seconds = clocktime.getSeconds();
    if (hours < 10) hours = “0” + hours;
    if (minutes < 10) minutes = “0” + minutes;
    if (seconds < 10) seconds = “0” + seconds;
    var clock = document.getElementById(‘digitalclock’);
    clock.innerHTML = hours + “:” + minutes + “:” + seconds;
    }, 1000));
    </script>[/PHP]

    BEFORE the </p> tag in <p class=”ja-day”>
    …..
    </p>
    PUT<span id=”digitalclock” style=”background-color:#D5D5D5; padding:1px; color:#fff;”> </span>

    That’s all 🙂
    Provided AS IS. Still, feedback (and THANKS) are highly appreciated 😀

    alexandrov Friend
    #361996

    Болшое спосибо!

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  alexandrov 14 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum