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

In - Đồng hồ số dùng ảnh - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Thời gian » Đồng hồ » Đồng hồ số dùng ảnh
URL: https://www.javascriptbank.com/live-clock-using-images-iii-index.html

Đồng hồ số dùng ảnh © JavaScriptBank.comHiệu ứng dùng hình ảnh để tạo một đồng hồ dạng số trên trang web.

Phiên bản đầy đủ: jsB@nk » Thời gian » Đồng hồ » Đồng hồ số dùng ảnh
URL: https://www.javascriptbank.com/live-clock-using-images-iii-index.html



HTML
<script language="JavaScript1.1"><!--/*Live clock using images IIIWritten by Alon Gibli (http://www.angelfire.com/biz6/deathrowtech)Visit http://wsabstract.com for this script and more*/// Setting variablesdig = new Image()dig[0] = '0.gif'dig[1] = '1.gif'dig[2] = '2.gif'dig[3] = '3.gif'dig[4] = '4.gif'dig[5] = '5.gif'dig[6] = '6.gif'dig[7] = '7.gif'dig[8] = '8.gif'dig[9] = '9.gif'//writing imagesdocument.write('<table border=1 cellspacing=0 bgcolor="silver">')document.write('<tr><td><img src="0.gif" name="hrs1"></img>')document.write('<img src="0.gif" name="hrs2"></img>')document.write('<td><img src="col.gif"></img>')document.write('<td><img src="0.gif" name="mins1"></img>')document.write('<img src="0.gif" name="mins2"></img>')document.write('<td><img src="col.gif"></img>')document.write('<td><img src="0.gif" name="secs1"></img>')document.write('<img src="0.gif" name="secs2"></img>')document.write('<td><img src="am.gif" name="ampm"></img></table>')//starting clock functionfunction showTime() {now = new Dateampmtime = now.getHours() - 12thisHrs = '' + now.getHours() + ''thisMin = '' + now.getMinutes() + ''thisSec = '' + now.getSeconds() + ''if (thisHrs > 9) {if (thisHrs >= 12) {document.ampm.src = 'pm.gif'             if (thisHrs==12)                    newHrs=''+12+''if (thisHrs > 12) {newHrs = '' + ampmtime + ''}if (newHrs <= 9) {document.hrs1.src = dig[0]document.hrs2.src = dig[newHrs.charAt(0)]}if (newHrs > 9) {document.hrs1.src = dig[newHrs.charAt(0)]document.hrs2.src = dig[newHrs.charAt(1)]}}else {document.ampm.src = 'am.gif'document.hrs1.src = dig[thisHrs.charAt(0)]document.hrs2.src = dig[thisHrs.charAt(1)]}}if (thisHrs <= 9) {document.ampm.src = 'am.gif'if (thisHrs == 0) {document.hrs1.src = dig[1]document.hrs2.src = dig[2]}else {document.hrs1.src = dig[0]document.hrs2.src = dig[thisHrs.charAt(0)]}}if (thisMin > 9) {document.mins1.src = dig[thisMin.charAt(0)]document.mins2.src = dig[thisMin.charAt(1)]}if (thisMin <= 9) {document.mins1.src = dig[0]document.mins2.src = dig[thisMin.charAt(0)]}if (thisSec > 9) {document.secs1.src = dig[thisSec.charAt(0)]document.secs2.src = dig[thisSec.charAt(1)]}if (thisSec <= 9) {document.secs1.src = dig[0]document.secs2.src = dig[thisSec.charAt(0)]}setTimeout("showTime()",1000)}window.onload=showTime// --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/time/Live_clock_using_images_III/Live_clock_using_images_III.zip