[thelist] setAttribute setting events

Jeff Howden jeff at jeffhowden.com
Thu Nov 6 16:46:06 CST 2003


danny,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Danny Goodman
> 
> 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.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

too tricky.

relies on browser-specific methods at getting at the target/srcElement.

better to just use an anonymous function.

elemReference.onmouseup = function()
{
  hideCharges(nNodeID);
}

.jeff

------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/



More information about the thelist mailing list