Javascript to image cycle
<p>Simple request, but I don't know how to do it. I've got a series of 10 images (image0.gif, image1.gif image2.gif etc...) that need to change to the next image in the sequence (cycling around after 9) when another image is pressed. This is what I have so far...</p>

<pre><code> &lt;html&gt;  
    &lt;head&gt;&lt;/head&gt;
    &lt;body bgcolor="#808080"&gt;
        &lt;script type="text/javascript"&gt;
            var c = 0;
            function preload(img) {
                var a = new Image();
                a.src = img;
                return a;
            }

            if (needed) {
                time0 = preload("image0.gif");
                time1 = preload("image1.gif");
                time2 = preload("image2.gif");
                time3 = preload("image3.gif");
                time4 = preload("image4.gif");
                time5 = preload("image5.gif");
                time6 = preload("image6.gif");
                time7 = preload("image7.gif");
                time8 = preload("image8.gif");
                time9 = preload("image9.gif");
            }

            function clickme() {
                // update image
                c += 1;
                // alert(c)
            }
        &lt;/script&gt;
        &lt;div align="center"&gt;
            &lt;center&gt;
                &lt;img src="images/image0.gif" width="20" height="55" name="time0"&gt; &lt;a href="#" onMouseDown="return clickme()"&gt;
                    &lt;img src="images/button.gif" border="0" width="96" height="55"&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/center&gt;
        &lt;/div&gt;
    &lt;/body&gt;

&lt;/html&gt;
</code></pre>
