Idocs Guide to HTML

Attribute for <IMG ...>
LOOP = INFINITE | -1 | # of loops

LOOP states how many times the movie should repeat itself. You can either state a finite number of loops, or you can make the movie loop forever. INFINITE (or -1) loops the movie over and over as long as the page is on the screen. For example, this code produces a movie which loops continuously:

<IMG 
   SRC="../graphics/moonflag.mpg" 
   DYNSRC="../graphics/moonflag.mpg"
   LOOP=INFINITE 
   ALT="Astronauts on the moon">

which gives us

Astronauts on the moon

You can specify a finite number of times for the movie to loop. This code produces a movie which loops ten times:

<IMG 
   SRC="../graphics/moonflag.mpg" 
   DYNSRC="../graphics/moonflag.mpg"
   LOOP=10 
   ALT="Astronauts on the moon">

which gives us

Astronauts on the moon

The problem with specifying a finite number of loops is that it is difficult to predict how many time is necessary to make sure the user will see the movie. For example, the movie in this example is way down near the bottom of the page. Even though the movie looped ten times, most users will not be down so far on the page before it is done. (It is worth noting that with some browsers, you can click once on the movie and it will run again the specified number of loops.) Either loop infinitely with INFINITE, control when the movie starts using the START attribute, or, best of all, use the CONTROLS attribute to give the user control over playing the movie. Don't use LOOP in the same tag as CONTROLS. There are inconsistent results as to which attribute takes precedence.

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.