We help IT Professionals succeed at work.

How to make a time counter in the webpage

Medium Priority
4,706 Views
Last Modified: 2013-12-16
I need to set a time counter. Then it may used for fixed time interval  refreshing webpage by AJAX.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
http://www.geocities.com/mangokun/programming/javascript/control_setTimeout.htm

Like that?  (the javascript is in the HTML source of the page)

Tim

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

Ask the Experts
Top Expert 2005
Commented:
Or you can use setInterval() which repeats it's self more than once

example:

setInterval('reloadPageByAjax()',60000);

which calls the function reloadPageByAjax() each minute.

setTimeout('reloadPageByAjax()',60000);

calls the function reloadPageByAjax() after 60 seconds, but then it doesn't call it again after 120, 180, 240 seconds etc.
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.