> I have a display clock that shows the time the user accessed the
> page but now they want a clock that shows the current time
> continuously.  I have figured out countdown timers but is there
> an easy way to display the current time continuously?

Here's a simple one that doesn't rely on DHTML, shows the date too, updates
every second, and flashes the colon (don't do that in public) so you know
it's running. Watch for line wrap on the new Array line!!:

<script language="JavaScript"><!--
// set clock variables
var blink=false
var monthArray = new
Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec
')
var dn="AM"
var myclock = ''

function showTime(){
 var Digital=new Date()
 var monthNumber=Digital.getMonth()
 var month=monthArray[monthNumber]
 var day=Digital.getDate()
 var hours=Digital.getHours()
 var minutes=Digital.getMinutes()
 if (hours>11){
   dn="PM"
   if (hours>12)        hours=hours-12
  }else{
   dn="AM"
 }
 if (hours==0)  hours=12
 if (minutes<=9)        minutes="0"+minutes
 myclock = month+' '+day+' - '
 if(blink==false){
   blink=true
   myclock += hours+':'+minutes+' '+dn
  }else{
   blink=false
   myclock += hours+' '+minutes+' '+dn
 }
 document.myClockForm.clockdisplay.value=myclock;
 setTimeout("showTime()",1000);
}
//-->
</script>

<form name=myClockForm>
<input name=clockdisplay type=text style="font-family:Lucida
Console,monospace;background-color:black;color:lime;font-size:9px;text-align
:center;" class=clockdisplay value="" size=19 noedit>
</form>


Ron Allen Hornbaker
President/CTO
Humankind Systems, Inc.
http://humankindsystems.com
mailto:[EMAIL PROTECTED]





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to