[thelist] Javascript addEventListener fail
Matt Warden
mwarden at gmail.com
Tue Jan 13 09:47:56 CST 2009
On Tue, Jan 13, 2009 at 10:40 AM, Barney Carroll
<barney.carroll at gmail.com> wrote:
> 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.
Are you just trying to get a reference to the element that triggered
changeTab()? You do not need to pass in 'i' for that.
http://mattwarden.com/sandbox/getidfromeventhandler.js
--
Matt Warden
Cincinnati, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
More information about the thelist
mailing list