then uses a client-side delta to advance the server-side time for use in
updating your display. It will have an error equal to the time it takes
from when the server-side date is written to the HTML buffer to when the
client-side date is computed. I have no idea of a way to get around that
without an extra round trip with something like Rob's JS web services thing.
<cfoutput>
<script>
window.clientDate = new Date();
window.serverDate = new Date("#jsStringFormat(dateFormat(now(), 'long') & '
' & timeFormat(now(), 'long'))#");
function updateClock() {
var curr = new Date(new Date().valueOf() - window.clientDate.valueOf() +
window.serverDate.valueOf());
// use the date to do whatever (probably write a div's content)
alert(curr);
}
setInterval("updateClock();", 1000);
</script>
</cfoutput>
Cheers,
barneyb
_____
From: kaigler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 04, 2004 9:55 AM
To: CF-Server
Subject: I know this is not the right place for the code request but....
I need some sort of _javascript_ clock that I can pass my server's time to and
it can increment on the site.
everything I see out there is using the users computer clock.
ideas, site referrals?
thanks,
kaigler
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
