Michael Kraus wrote: >Eg. >// Inside constructor >for (i = 0; i < divArray.length; i++) >{ > divListener = new EventListener(divArray[i]); > divLittener.onmouseover = function(e) > { > target = e.getTarget(); > target.setHTML("This is div#: " + i); > } >} > <-- snip -->
>Is there a way to pass the for loops index as a parameter to the >EventListener at the for loops execution time, rather than the >EventListener's execution time? > There is a method for creating a function based on a string. This is seen in the following example: for (i = 0; i < divArray.length; i++) { divListener = new EventListener(divArray[i]); divLittener.onmouseover = new Function('e','target = e.getTarget(); target.setHTML("This is div#: "' + i + ');'); } You will notice that the string can now contain the value of your variables instead of a reference to it. Useful for small amounts of code, but a pain when you are using large chunks of code. -- Michael Pemberton [EMAIL PROTECTED] ICQ: 12107010 _______________________________________________ Dynapi-Help mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dynapi-help