Reply
Daily event countdown timer
Old 01-09-2008, 05:35 AM Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Hi all,

I have very little knowledge of JavaScript and need help to creat a countdown timer.

Basically, I need a counter that counts down to a daily event, displays a message and then starts the countdown again 2 hours later.

eg Count down to 6pm, display message for 2 hours, start countdown again at 8pm

The counter has to be GMT and our host is in the USA ( not sure if this matters?)

Hope this makes sense?

Any help would be greatly appreciated.
Captain Cross is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 01-09-2008, 03:17 PM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
javascript uses the time on the local machine for the times where the users clock may or may not be accurate.

You would be better off handling this server side and adjusting for GMT.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-10-2008, 04:25 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Cheers for the reply Chris.

I did read somewhere that using the server clock was a better method than local machine. But I have no idea how to do that or to adjust it to GMT.

I have searched for code and there are lots of countdown scripts out there, but I can't find anything that would suite my situation. Plus I don't understand most of them. I have never used JavaScript.

If you or someone else could supply me with some code or point me in the right direction, that would be great.

Cheers
Captain Cross is offline
Reply With Quote
View Public Profile
 
Old 01-10-2008, 04:35 AM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
Shouldn't be a problem, what server side code can you run?

php, asp, .net
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-10-2008, 04:39 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
I think all three, but most of the pages are ASP, so might as well stick with that.
Captain Cross is offline
Reply With Quote
View Public Profile
 
Old 01-10-2008, 04:53 AM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
Ok, moving thread and I'll see what I can come up with later in the day
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-11-2008, 10:21 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Hi Chris, me again

Did you have any joy with this little problem of mine?

Cheers
Captain Cross is offline
Reply With Quote
View Public Profile
 
Old 01-11-2008, 01:52 PM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
aye, working on it.

Got side tracked with some proper work.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 05:23 AM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
OK.

vBScript class (OOP) for displaying a timed message.

it is set to return a UTC time but you can set if DST is active and return a GMT Time as well.
Also a property is there for setting a local offset time (+/- 12hours) so it's not limited to use in the GMT time zone.

Download zip file
with the include files in it.

And of course if you want to get really silly you could instantiate 24 objects and have a different message showing at every hour of the day.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 07:03 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Cheers Chris,

It all looks very complicated. Well, to me anyway. I'll try and make it work.
Captain Cross is offline
Reply With Quote
View Public Profile
 
Old 01-14-2008, 08:05 AM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
No it's dead simple to the end user.

You don't need to get involved in the class file at all. It's one of the biggest benefits of Objects. All you need to know is how to create the object (set objName = new "ClassName"), put values in and get other values out.
It works in the same way as ADO does.

You (as the end user) don't need to know how the driver "talks" to the database, all you need is know is how to tell it where the DB is (objConn.ConnectionString) how to open it (objConn.Open) and how to get values out (objRS.Fields("name") ).
Behind all that is some very complicated processing happening, without you even being aware of what is being done.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 08:25 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
See, you've lost me already. lol.

I don't want a user to be able to input anything. Just want it hard coded into the page so it displays in the top right for example. Is this easy to do? Will I have to change much code.

The other thing is, it don't show the time counting down. I need to be able to see the clock counting down (like a stopwatch) until it gets to the desired time and then fire a message up for a set period of time. The start again.

Any ideas? Or shall I just stick to what I know? Nowt!
Captain Cross is offline
Reply With Quote
View Public Profile
 
Old 01-14-2008, 03:18 PM Re: Daily event countdown timer
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
the form setup was purely for testing and demonstration, so anybody can change the preset times and see that it works.

Showing a countdown shouldn't be an issue, few minor changes to the way the times are set into the class, couple of extra properties to calculate remaining time and a bit of AJAX scripting to communicate between client and server, then reload when the count hits 0



or of course you could use a 5 or 10 second meta refresh
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Daily event countdown timer
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16542 seconds with 13 queries