»
Tiếng AnhTiếng PhápTiếng Việt

In - Đồng hồ kèm lời chào hỏi - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Thời gian » Đồng hồ » Đồng hồ kèm lời chào hỏi
URL: https://www.javascriptbank.com/clock-and-greeting.html

Đồng hồ kèm lời chào hỏi © JavaScriptBank.comHiệu ứng dựa vào giờ hệ thống để hiển thị thời gian và lời chào đến bạn.

Phiên bản đầy đủ: jsB@nk » Thời gian » Đồng hồ » Đồng hồ kèm lời chào hỏi
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-->