Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 10
Location: Sheffield
Trades: 0
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
 
 
Register now for full access!
Old 01-09-2008, 04:17 PM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-10-2008, 05:25 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Trades: 0
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, 05:35 AM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Shouldn't be a problem, what server side code can you run?

php, asp, .net
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-10-2008, 05:39 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Trades: 0
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, 05:53 AM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Ok, moving thread and I'll see what I can come up with later in the day
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-11-2008, 11:21 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Trades: 0
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, 02:52 PM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
aye, working on it.

Got side tracked with some proper work.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 06:23 AM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 08:03 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Trades: 0
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, 09:05 AM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-14-2008, 09:25 AM Re: Daily event countdown timer
Captain Cross's Avatar
Novice Talker

Posts: 10
Location: Sheffield
Trades: 0
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, 04:18 PM Re: Daily event countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Daily event countdown timer
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.51096 seconds with 12 queries