'this' exists? index really should be there. Which mootools version
are you using? Is mootools loaded properly in the html page? Any error
showed?

On 3 mar, 09:34, Fábio Costa <[email protected]> wrote:
> Could you send us a link for this problem?
> It seens that everything is correct on your code, but maybe another thing on
> your site might be affecting this code, causing this strange behavior.
>
> Fábio Miranda Costa
> Engenheiro de Computaçãohttp://meiocodigo.com
>
> On Tue, Mar 3, 2009 at 6:47 AM, Michal <[email protected]> wrote:
>
> > I would really expect that index would be defined in that loop. Can I
> > just check that you have posted exactly what you're running?
>
> > On Mar 3, 2:52 am, Matt Thomson <[email protected]> wrote:
> > > Hi does anyone know how I would do this:
>
> > > html:
>
> > > <div id="img_holder">
> > >    <img src="img1.gif" />
> > >    <img src="img2.gif" />
> > >    <img src="img3.gif" />
> > > </div>
>
> > > javascript:
>
> > > this.imageArray = $('img_holder').getElements('img');
>
> > > this.imageArray.each(function(el,index)
> > > {
> > >     el.addEvent('click', function()
> > >     {
> > >         alert(index + 1);
> > >         //if image 1 is clicked I want it to alert "1"
> > >        //if image 2 is clicked I want it to alert "2"
> > >        //presently index is undefined
> > >      });
>
> > > });
>
> > > Thanks,
>
> > > Matt.

Reply via email to