Load image with timer : setTimeout « Window Browser « JavaScript DHTML






Load image with timer

  
<html>
<head>
<title>Timers</title>
<script type="text/javascript">
var ct = 0;
var imgs = new Array("a.gif","b.gif","c.gif");
setTimeout("progress()",3000);

function progress() {
   if (ct < 3) {  
      document.images[0].src=imgs[ct];
      ct++;
      setTimeout("progress()",3000);
   }
}
</script>
</head>
<body>
<img src="d.gif" />
</body>
</html>

   
    
  








Related examples in the same category

1.meta http-equiv="refresh" content="30" and timer
2.Windows timer
3.Start a timer and cancel a timer