[Javascript] Setting event handlers on a dynamically created row

Håkan Magnusson hakan at backbase.com
Sun Mar 7 06:46:43 CST 2004


Create an anonymous wrapping function?

rowTemp.onmouseover = new function() { yourFunction(param1, param2, 
param3); };

If I understand you correctly, I think this is the only way to achive 
what you want.

Regards,
Hakan

Peter Brunone wrote:
> 	Okay, so maybe that was a silly question, considering the
> availability of attachEvent() in later versions of Javascript, but I'd
> still like to know how to point it to a function with parameters.
> 
> Thoughts?
> 
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of Peter Brunone
> 
> Hi all...
> 
> 	If I create a row or a cell on a table, how do I assign
> functions (specifically functions with parameters) to its event
> handlers?  Experience tells me that if I assign 
> 
> rowTemp.onmouseover = thisFunction(this)
> 
> it will of course assign the *return value* from that function, which of
> course is wrong.  However, if I assign 
> 
> rowTemp.onmouseover = "thisFunction(this)"
> 
> I would think it would be taken as a string, and not as a function.  The
> only other option I can imagine -- using eval() on the string I'm
> assigning -- would seem to have the same result as the first.  Can
> anyone shed some light on what I'm supposed to do here?
> 
> Cheers,
> 
> Peter Brunone
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list