You use setInterval in Javascript to execute a callback function every
so milliseconds:

window.setInterval(doSomething, 1000); // 1000ms = 1sec

function doSomething() {
  // code to change images
}

On Oct 15, 11:25 am, -e-train <etrai...@gmail.com> wrote:
> All -
>
> How would i get the following effect.
>
> load the page and and image appears, then after 1 second, another
> image appears next to the previous one, then after one second, another
> image apears next to the previous one, etc...
>
> so each second a new image is placed in the line of images, eventually
> filling the screen with a bunch of images...
>
> I assume it is a for loop and something.
> or do i have to do it in php.
>
> in php this is the equivalent:
> for ($i = 0; $i < 5; $i++) {
>  print '<img src="image.png" />';
>  ob_flush();
>  flush();
>  sleep(1);
>
> }
>
> but this isn't really a good way to do this.
>
> any ideas?
>
> cheers,
> -e-train

Reply via email to