We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

JavaScript Countdown Timer:  Need To Count Down and Then Redirect The User

inverted_2000
on
Medium Priority
243 Views
Last Modified: 2012-05-05
Hey Everyone,

I'm sure this is already out there but it has been harder then I thought it would be to locate just what I am looking for.  I'm testing with my site and I've got a full screen window that has 2 frames...top.cfm and bottom.cfm in the frameset.cfm frame.  On the top frame, I need to count down from 1 hour and 30min to 0 where 0 is when the test time is up for the student and they are redirected to another webpage.

Who's got a nice and easy fuction that can be configured pretty easily...

Thanks a lot,
inverted_2000
Comment
Watch Question

Author

Commented:
Anyone today have a time left counter for me?
CERTIFIED EXPERT
Top Expert 2006
Commented:
You can use

setInterval('mycountdownfunction()', 1000); //1000 ms = 1 second

Then have:

var numberofseconds = 60 * 90;
function mycountdownfunction() {
  numberofseconds--;
  if(numberofseconds <= 0) {
     do something
  }
}

However, you should also keep track of time serverside, as javascript could be bypassed by inventive users.

-r-

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.