»
EnglishFrenchVietnamese

Print - Bar Clock script - JavaScriptBank.com

Full version: jsB@nk » Time » Clock » Bar Clock script
URL: https://www.javascriptbank.com/bar-clock-script.html

Bar Clock script © JavaScriptBank.comDisplay hours, minutes, and seconds in bars, also gives you hours, minutes, seconds, and complete time with AM, PM status. Great!

Full version: jsB@nk » Time » Clock » Bar Clock script
URL: https://www.javascriptbank.com/bar-clock-script.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Author Abraham I. ([email protected])<!-- Beginfunction clock() {var t = new Date();var h = t.getHours();var m = t.getMinutes();var s = t.getSeconds();var units = newString("");var hours = t.getHours();var min = t.getMinutes();var sec = t.getSeconds();document.clock.hours.value = units.substring(0, hours);document.clock.minutes.value = units.substring(0, min);document.clock.seconds.value = units.substring(0, sec);var status = "AM";if (hours > 11)status = "PM";if (hours < 11)hours -= 12;if (min < 10)min = "0" + min;if (sec < 10)sec = "0" + sec;document.clock.h.value = hours;document.clock.m.value = min;document.clock.s.value = sec;document.clock.time.value = hours + ":" + min + ":" + sec + " " +status;window.setTimeout("clock()", 900);}// End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="clock();"><form name="clock"><table><tr><td>Hours:</td><td><input type="text" name="h" size="10" style="border: 0px none; "></td></tr><tr><td colspan=2><input type=text name="hours" size="24" style="color: navy"></td></tr><tr><td>Minutes:</td><td><input type="text" name="m" size="10" style="border: 0px none; "></td></tr><tr><td colspan=2><input type=text name="minutes" size="60" style="color: navy"></td></tr><tr><td>Seconds:</td><td><input type="text" name="s" size="10" style="border: 0px none; "></td></tr><tr><td colspan=2><input type=text name="seconds" size="120" style="color: navy"></td></tr><tr><td>Time:  <input type=text name="time" size="20" style="border:0px none; "></td></tr></table></form></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->