document.getElementbyID and looping
<pre><code>&lt;body&gt; 
    &lt;div id="page"&gt; 
    &lt;img id="slot0" class=slot src="crab.gif" width="120" height=80&gt;
    &lt;img id="slot1" class=slot src="sun.gif" width="120" height=80&gt;
    &lt;img id="slot2" class=slot src="sail.gif" width="120" height=80&gt;
</code></pre>

<p>Below I want to use y to replace 0, 1 &amp; 2</p>

<pre><code>var slotValues = new Array(3);
var slots = new Array ('0','1','2');

for (y=0;y&lt;=slots.length;y++){

slotValues.push (document.getElementById("slot" + slots[y]));}
</code></pre>

<p>But IE said <code>document.getElementById("slot" + slots[y])</code> is not an object though I think it is and if I change <code>slot[ y]</code> to 0, it can find but it is not being dynamic.
Could you please check where I went wrong.</p>
