you don't have to use this at all,
On Fri, Mar 6, 2009 at 1:43 PM, ibolmo <[email protected]> wrote: > > Because .each() doesn't return anything. > > var a = [0,1,2].each(fn); > console.log(a); // undefined > > On Mar 6, 3:15 am, electronbender <[email protected]> wrote: > > Why use this ? > > Just use imgArray = $$('#img_holder img') > > and then imgArray.each.... > > > > On Mar 3, 3: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. > -- fax : (+33) 08 26 51 94 51
