[thelist] setAttribute setting events
Danny Goodman
dannyg at dannyg.com
Thu Nov 6 14:11:18 CST 2003
on 11/6/03 11:57 AM, thelist-request at lists.evolt.org wrote:
> I've tried about half a dozen methods of setting the attribute but none
> of them has worked for both IE and Moz. Could anyone help me???
Using setAttribute() for event handlers is too messy in IE (as you
discovered, all it does -- unless you use the function object generation
tactic -- is assign the string value to the attribute).
Since you want to pass a value along to the event handler function, you
might think that you can't use parameterless event binding, but you can get
what you want without too much effort:
elemReference.onmouseup = hideCharges;
elemReference.setAttribute("nodeID", nNodeID);
Then, in your hideCharges() function, get the target/srcElement of the event
and use getAttribute("nodeID") to retrieve the nNodeID value.
Danny
http://www.dannyg.com
More information about the thelist
mailing list