»
AnglaisFrançaisVietnamien

Imprimer - Horloge et de voeux - JavaScriptBank.com

Version complète: jsB@nk » Heure » Horloge » Horloge et de voeux
URL: https://www.javascriptbank.com/clock-and-greeting.html

Horloge et de voeux © JavaScriptBank.comNe vous contentez pas de plus accueillir vos visiteurs, JavaScript peut écrire du bon matin, bonne soirée, bon après-midi ou sur la base du temps, la page a été chargée, conformément à l'utilisateur de l'horloge système. Neat!

Version complète: jsB@nk » Heure » Horloge » Horloge et de voeux
URL: https://www.javascriptbank.com/clock-and-greeting.html



JavaScript
<SCRIPT language=JavaScript><!--var timerID = nullvar timerRunning = falsefunction stopclock(){    // cannot directly test timerID on DEC OSF/1 in beta 4.    if(timerRunning)        clearTimeout(timerID)    timerRunning = false}function startclock(){     // Make sure the clock is stopped    stopclock()    showtime()}function showtime(){    var now = new Date()    var hours = now.getHours()    var minutes = now.getMinutes()    var seconds = now.getSeconds()    var month = now.getMonth()    var datum = now.getDate()    var year = now.getYear()    var timeValue = ((hours<4)?"You're up late!":(hours<10)?"Good morning!":((hours<12)?"Good day!":((hours<18)?"Good afternoon!":((hours<23)?"Good evening!":"You're up late!"))))    var timeValue2 = "" + ((hours > 12) ? hours - 12 : hours)    timeValue2 += ((minutes < 10) ? ":0" : ":") + minutes    timeValue2 += ((seconds < 10) ? ":0" : ":") + seconds    timeValue2 += (hours >= 12) ? " PM" : " AM"    var timeValue3 = "" + datum + "/"    timeValue3 += (((month + 1) < 10) ? "0" : "") + (month + 1)//    timeValue3 += ((month=0)?"January":((month=1)?"February":((month=2)?"March":((month=3)?"April":((month=4)?"May":((month=5)?"June":((month=6)?"July":((month=7)?"August":((month=8)?"September":((month=9)?"October":((month=10)?"November":((month=11)?"December":(("month=12"))))))))))))       timeValue3 += "/" + year//    timeValue3 += ((seconds < 10) ? ":0" : ":") + seconds//    timeValue3 += (hours >= 12) ? " PM" : " AM"        document.clock.face.value = timeValue    document.clock.face2.value = timeValue2    document.clock.face3.value = timeValue3    timerID = setTimeout("showtime()",1000)    timerRunning = true}//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=startclock()><FORM name=clock><INPUT name=face size="20"> <INPUT name=face2 size="20">   <INPUT name=face3 size="20"> </FORM></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->