-4

Hi i need help i want my site to have a count up timer for example https://www.quickiepaydayloans.co.uk/index1.html

look in the speech bubble

at the min the timer counts up but its not what i want what i want is a counter that i can set to count up from say "2,000" or what ever i need it refreshes every so many msec and goes up randomly 1,2,3,4 at a time and so i can set the speed i can make it so say every hour it may increase by 50 or 100 or what ever and never ends unless i change the count up time.

i need it to be a constant thing like a count down timer so if i was to refresh the page it does not reset.

also i would like it so between the 0's every 3 it will add a comma so when it gets to thousand it will read 1,000 and 1,000,000 and so on :D

if that makes sense to anyone hope someone can help

  • People will vote down you question. Please have a look here: http://stackoverflow.com/faq You should specify a concrete problem and maybe post some code. – Jacob T. Nielsen Oct 29 '12 at 14:14
  • i don't know java script and i have been awake for over 36 hours trying everything i can but i dont know enough to fix it :-( – Devon Chapman Oct 29 '12 at 14:16
  • i used the code from here http://stackoverflow.com/questions/2540277/jquery-counter-to-count-up-to-a-target-number – Devon Chapman Oct 29 '12 at 14:17
  • This is a site for developers to request help with their problems, not clients looking for professionals to do work for free. http://stackoverflow.com/questions/11246/best-resources-to-learn-javascript – Jan Oct 29 '12 at 14:20
  • i'm am not a client looking for free work i own a seo company and a webdesign company but my staff who normally deals with this for our clients left .. if any one can solve it i dont mind paying at all – Devon Chapman Oct 29 '12 at 14:22

1 Answers1

0

I will assume you are looking for general assistance and "point me in the general direction" rather than "send me the codes", and respond accordingly.

First, the thing you are asking for is going to require something more than javascript, and will, in fact, be a lot more complicated than you might think. Consider:

  • Having the timer not refresh when you refresh the page means that you either need to tie it to date/time or you need some form of permanence. The two kinds of permanence you have to work with are cookies and server-side. Cookies are the user-specific version, and would have a large overhead. They're not designed to update as frequently as they'd have to update to achieve reasonable consistency between refreshes. Server-side (where everyone who visits the page at the same time gets the same counter) is potentially doable, but that would mean that you'd have to make the page dynamic on the server side, you'd have to have an independent thread to update the counter, and you'd need to be running near-constant asynch calls in order to keep the page and the server synched. Again, not somethign that's meant to be run on the order of msecs. Tying it to Date/Time (again, everyone gets the same) is cool, and is what most such counters would use, but it runs into another problem.

  • You've said that you want the timer to go up by a random number. This, unfortunately, shoots tying it to date/time right out of the water, since the date/time method won't record what you've done. You can call rand functions and update appropriately, but there's no way to persist the information between refreshes.

Basically, then, you can give up on the persistence, in which case you can use a rand function for your 1-4, and run it all on the client side, and everything will work fine, or you can give up on the counting randomness, in which case you can tie it to date/time, and everything will work fine, or you can try to handle persistence with cookies or server-side shenanigans, in which case this gets ugly.

the commas are a matter of formatting, and not terribly difficult. I believe there are easy out-of-the-box solutions for that one, and even if not, everything in javascript is handled as a string, and you can insert the commas manually after you have your number.

counting up rather than down is also pretty trivial.

Ben Barden
  • 2,001
  • 2
  • 20
  • 28
  • Thanks for the reply yes its pointed me in the right direction :D big help thanks – Devon Chapman Oct 29 '12 at 14:46
  • Glad to have helped. Given that you feel that way, I would appreciate it if you would click the green check-mark next to my answer (indicating that you accept it as the answer to your question). – Ben Barden Oct 29 '12 at 15:09