Why won't my animation run?
<p>When I run the code on my site it starts off with image jackhammers1 instead of jackhammers0 and won't execute the startBouncing() method. it just displays the form with one image and no animation. It is an example copied from the textbook so I don't see how it shouldn't work.</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;

&lt;title&gt;JackHammer&lt;/title&gt;


&lt;script type="text/javascript"&gt;

/* &lt;![CDATA[ */

var jackhammers = newArray(11);
var curJackhammer = 0;
var direction;
var begin;
jackhammers[0] = "jackhammer0.gif";
jackhammers[1] = "jackhammer1.gif";
jackhammers[2] = "jackhammer2.gif";
jackhammers[3] = "jackhammer3.gif";
jackhammers[4] = "jackhammer4.gif";
jackhammers[5] = "jackhammer5.gif";
jackhammers[6] = "jackhammer6.gif";
jackhammers[7] = "jackhammer7.gif";
jackhammers[8] = "jackhammer8.gif";
jackhammers[9] = "jackhammer9.gif";
jackhammers[10] = "jackhammer10.gif";


function bounce(){

    if(curJackhammer == 10)
        curJackhammer = 0;
    else
        ++curJackhammer;
        document.getElementsByTagName("img")[0].src = jackhammers[curJackhammer].src;

    if(curJackhammer == 0)
        direction = "up";

    else if(curJackhammer == 10)
        direction = "down";
        document.getElementsByTagName("img")[0].src = jackhammers[curJackhammer];
}

function startBouncing(){

    if (begin)
        clearInterval (begin);
    begin = setInterval("bounce()",90);
}


/* ]]&gt; */

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;Jackhammer Man&lt;/h1&gt;

&lt;p&gt;&lt;img src="jackhammer1.gif" height="113" width="100" alt="Image of a man with a jackhammer." /&gt;&lt;/p&gt;

&lt;form action="" enctype="text/plain"&gt;
    &lt;p&gt;
        &lt;input type="button" value="Start Bouncing" onclick="startBouncing();" /&gt;
        &lt;input type="button" value="Stop Bouncing" onclick="clearInterval(begin);" /&gt;
    &lt;/p&gt;
&lt;/form&gt;

&lt;/body&gt;

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