»
EnglishFrenchVietnamese

Print - Hexadecimal Clock script - JavaScriptBank.com

Full version: jsB@nk » Time » Clock » Hexadecimal Clock script
URL: http://www.javascriptbank.com/hexadecimal-clock-script.html

Hexadecimal Clock script © JavaScriptBank.comHex is an easier way to deal with binary. Four binary bits can be represented by one hex digit, which allows you to figure out the binary code in 'chunks' of 4 bits. The counting scheme can be a little confusing, especially when you start seeing letters.

Full version: jsB@nk » Time » Clock » Hexadecimal Clock script
URL: http://www.javascriptbank.com/hexadecimal-clock-script.html



JavaScript
<script language="javascript">var hexclk;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(hexclk, 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){nbr=nbr.toString(16);while(nbr.length!=2)nbr='0'+nbr;return nbr;}window.onload=function(){hexclk=(ns4)?document.layers['hexclk']:(ie4)?document.all['hexclk']:document.getElementById('hexclk');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="hexclk" 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-->