Tana blogja
"A gyertya semmit sem veszít azzal, ha lángra lobbant egy másik gyertyát !"   

Javascript clock

január 22nd, 2007 by Tana

<body onLoad="loadtime()">

…..

function createtime()
{
    var time = new Date()
    var hours = time.getHours()
    var minutes = time.getMinutes()
    var seconds = time.getSeconds()
    var abbrev = "AM"
    if (hours==0) hours=12

    if (minutes<=9) minutes="0"+minutes
    if (seconds<=9) seconds="0"+seconds
   
    var ctime=""+hours+":"+minutes+":"+seconds
    if (document.all) document.all.clock.innerHTML=ctime
    else if (document.getElementById) document.getElementById("clock").innerHTML=ctime
    else
        document.write(ctime)
}

    if (!document.all&&!document.getElementById) createtime()

function loadtime()
{
    if (document.all||document.getElementById) setInterval("createtime()",1000)
}

 

Posted in php |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.