loop that executes a function. However, the following works - the counter counts while the images on the page are loaded.
var progress = function()
{
for (var i = 0; i < slide.length; i++)
slide[i].onload = function(){
actualprogress +=1,
loading.innerHTML = actualprogress
};
}
While the following does not work. When I open the Page the counter says "[n]" (number of slides, e.g. "12") from the beginning.
var progress = function()
{
var action = function(){
actualprogress +=1;
loading.innerHTML = actualprogress
}
for (var i = 0; i < slide.length; i++)
slide[i].onload = action();
}
I would like to call a function from the for-loop because I will need to do other and more things within the function. Why doesn't this work?