»
EnglishFrenchVietnamese

Print - BCD Clock script - JavaScriptBank.com

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

BCD Clock script © JavaScriptBank.comBCD is a special binary system where EACH individual decimal digit is represented by 4 binary bits. So, the binary count can go no higher than 9 ("10" would be represented by 8 binary digits: 4 for the "1", and 4 for the "0").

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



JavaScript
<script language="javascript">var binclk;var now;var ns4 = (document.layers)? true : false;var ie4 = (document.all && !document.getElementById)? true : false;var ns6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;function setclock(){now=new Date();var txt=getstring(now.getHours()+'')+' : '+getstring(now.getMinutes()+'')+' : '+getstring(now.getSeconds()+'');if(ns4) txt='<div style="position:absolute; top:0px; left:0px"><center><b>'+txt+'</b></center></div>'; writeid(binclk, txt);}function writeid(id,text){if(ns4){id.document.open();id.document.write('<div style="position:absolute; left:0px; top:0px;">'+text+'</div>');id.document.close();}else id.innerHTML=text;}function getstring(nbr){while(nbr.length<2) nbr='0'+nbr;nbr=nbr.split('');nbr[0]=eval(nbr[0]).toString(2);nbr[1]=eval(nbr[1]).toString(2);while(nbr[0].length<4) nbr[0]='0'+nbr[0];while(nbr[1].length<4) nbr[1]='0'+nbr[1];return nbr[0]+','+nbr[1];}window.onload=function(){  binclk=(ns4)? document.layers['binclk']:(ie4)?document.all['binclk']:document.getElementById('binclk');  setInterval('setclock()', 300);}window.onresize=function(){if(ns4)setTimeout('history.go(0)', 400);}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<table cellpadding="0" cellspacing="0" border="0"><tr><td align="center" width="300"><div id="binclk" style="position:relative; width:300px; height:25px; font-weight:bold"></div></td></tr></table><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->