Dynamic Events in Javascript

WITHOUT PARAMETERS
Element.<<EVENT>> = <<FUNCTION-NAME>>
eg: document.onLoad = showShadow;

WITH PARAMETERS
Element.<<EVENT>> = function(){ <<FUNCTIONNAME>>(<<PARAM LIST>>)};
eg:  element.onClick = function(){ showAlert(param1,param2) }; // This is a reference to a function
posted @ Friday, May 18, 2007 9:15 PM
Print

Comments on this entry:

# re: Dynamic Events in Javascript

Left by barmaley at 9/24/2009 10:33 AM
Gravatar
HEy, in the second case do you know how to pass value of the variable(e.g. value of param1) rather then variable itself(param1)?

# re: Dynamic Events in Javascript

Left by Guna at 8/10/2010 7:59 PM
Gravatar
Thanks! good stuff...

# re: Dynamic Events in Javascript

Left by sundarraj at 2/2/2011 1:35 AM
Gravatar
ok

Your comment:



(not displayed)

 
 
 
 

Live Comment Preview: