This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Set Time Interval Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Set Time Interval" Watch "Set Time Interval" New topic
Author

Set Time Interval

naval kumar
Ranch Hand

Joined: Jul 08, 2012
Posts: 37
Dear Sir,
I have to call 3 Function After Set a time Of Interval How can I call It. Like On The page Load I am calling and From This function onloadfun() i want to call these function After Specific Time Interval like After 6 seconds . But My Problem is that After Setting Time Interval in function. My Only One function is called again and again But reaming Two function is not calling.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Use setTimeout(), not setInterval(). read up on the differences between these two timer functions.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

There's also no need to wrap the function(s) in anonymous functions:

naval kumar
Ranch Hand

Joined: Jul 08, 2012
Posts: 37
Its Againg Create problem I have One Function like and i want to call this function


from this function again and again
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 270
    
    4

If you want to pass parameters, and you need it to work in IE, then do wrap the function(s) in anonymous functions. If you don't need to support iE, then put the parameters after the timeout:

There is a workaround to enable the standard behaviour in IE.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Set Time Interval
 
Similar Threads
setInterval Overhead
doubt related to output involving precedence of | and &&
Not Getting the Latest data from databases in jsp page
problem in servlet with Ajax
How to refresh DIV