I always wanted to know how to do this so i thought i'd share. It looks like the dynamic clock on this site:
http://tutorial320.easycfm.com/tutor...m?dirView=True
Code:<script> function getClock() { document.getElementById('clock').innerHTML= updateClock(); // make a call to the updateClock() function to return the current time value } // this function uses settimeout function function updateClock() { var now = new Date(); var clock = setTimeout("getClock()", 1000); //update getClock() function ////////////////////////////////////////// clock = now.getMonth()+1 + "/" + now.getDate() + "/" + now.getYear() + "-" + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(); ////////////////////////////////////////// return clock; } // this is more like an endless loop where two functions call each other </script> <!----------------------------------------------------------------------> <body onLoad="getClock()"> <h4 id="clock"></h4>


LinkBack URL
About LinkBacks






Reply With Quote