The moose likes HTML, CSS and JavaScript and the fly likes Update time Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Update time" Watch "Update time" New topic
Author

Update time

Saulo Menezes
Greenhorn

Joined: Jan 15, 2003
Posts: 17
Hya!
I have set a digital timer on my page by using Javascript but I don't know how to create the function to update this time. Up to now the time just updates if I reload the page. I would be grateful if somebody could tell me how to do it. I have found out that setInterval can be called to do it but I didn't manage to make it work.
I am looking forward to hearing from you.
Yours,
Saulo
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1028
Hi Saulo,
it's: setTimeout( String nameOfFunction, int milliseconds )
Because you need it after 1 second milliseconds is 1000. If your function is named showTime it goes:

it's like calling showTime recursively but with a delay of 1000 ms
[ May 16, 2003: Message edited by: Christian Baron ]
 
jQuery in Action, 2nd edition
 
subject: Update time
 
Threads others viewed
How to store the page context and where would it be better.
can i control the flow validation if i use validator.xml
how to refresh captcha image
submit form problem
validation.xml is miss firing
IntelliJ Java IDE