problem with setTimeout function "not defined"!
What is the problem with this code?
$(document).ready(function(){ function ISS_NextImage() { //ImageSlideShow NextImage $('.ImageSlideShow').each(function() { alert($(".correntImage", this).text()); }); } var t=setTimeout("ISS_NextImage();",1000); });
When you eval code, this is done in a global scope. Since the function you are trying to call is locally restricted, this fails.
eval
Pass the setTimeout function instead of passing the string eval ed.
setTimeout
var t=setTimeout(ISS_NextImage,1000);
Try changing your dialing timeout:
var t=setTimeout(function(){ISS_NextImage();},1000);
Avoid passing strings to setTimeout (). Just pass the link to the function:
var t = setTimeout(IIS_NextImage, 1000);
you also can:
$(function() { var t = setTimeout(new function() { $('.ImageSlideShow').each(function() { alert($(".correntImage", this).text()); }); }, 1000); });
You can do something like this:
$(document).ready(function(){ setTimeout(ISS_NextImage,1000); }); function ISS_NextImage() { $('.ImageSlideShow').each(function() { alert($(".correntImage", this).text()); }); }