Timeout doesn't work

function updateimage(){
setTimeout(updateimage(), 5000);

This is the code i tried. Its a code to reload the image every 5 seconds. But it doesn't work. I get this error in IE: Invalid argument Can y'all help me? Thanks.


2 options.

setTimeout("updateimage()", 5000)


setTimeout(function() {
}, 5000);

You should pass the actual function as argument and not the call:

setTimeout(updateimage, 5000);


setTimeout('updateimage()', 5000);

Need Your Help

Designers to Developers-What should I know?

design client protocols

This is a broad question, so let me narrow it a bit. I am a graphic designer entering the world of web design. I'm not totally green in this field, but I know enough to know that I have a lot to le...

Why is my CalendarExtender getting overlapped when rendered?

asp.net-ajax calendarextender

I'm working on a .NET web application and I'm using a CalendarExtender control within it to have the user specify a date. For some reason, when I click the icon to display the calendar, the backgro...

Practical examples of use for Clojure's new some-> macro


Clojure 1.5 adds new threading macros, including:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.