[thelist] Javascript addEventListener fail

Barney Carroll barney.carroll at gmail.com
Tue Jan 13 09:40:13 CST 2009


Hi guys,

This has always stumped me. Usually I end up going about the problem a
completely different way and drop addEventListener completely, but I'd like
to get to the bottom of what I'm missing.

Here is the problematic line of script:

th3s[i].addEventListener('click', 'changeTab('+i+')', false);

This is inside a for loop, and the event needs to be evaluated — which I
can't seem to make it do. Firebug tells me that it "could not convert
JavaScript argument" on this line.

th3s is an array of elements and they're all fine. I'm working out how to do
this the ECMA way, so don't put it down to IE not understanding that
function — I'll deal with it when I can make this work in the real world.


Regards,
Barney Carroll
Web designer & front-end developer

t: +44 (0) 7594 506 381



More information about the thelist mailing list