But you can get information of the object where the event occured. e. g. you can do stuff dependent on the "ID" of an object, or you can set any additional flags within the object and do stuff dependent on these flags.
Here we have the code for attaching the events:
If (window. addeventlistener) {// Mozilla, Netscape, firefoxobject. addeventlistener ('mouseover', testevent, false); object. addeventlistener ('click', testevent, false); object. myflag = "test"; object. mydata = "123";} else {// ieobject. attachevent ('onmouseover', testevent); object. attachevent ('onclick', testevent); object. myflag = "test"; object. mydata = "123 ";}
The function "testevent" contains all code to access the "ID", "name" etc. And all own flags:
Function testevent (EVT) {var e_out; var ie_var = "srcelement"; var pai_var = "target"; var prop_var = "myflag"; // "target" for Mozilla, Netscape, firefox et al .; "srcelement" for ieevt [comment _var]? E_out = EVT [cmd_var] [prop_var]: e_out = EVT [ie_var] [prop_var]; alert (e_out); prop_var = "mydata"; EVT [cmd_var]? E_out = EVT [pai_var] [prop_var]: e_out = EVT [ie_var] [prop_var]; alert (e_out );}
Conclusion: If you set appropriate flags When attaching an event to an object, you have the possiblity to do actions dependent on these flag when the actual event occurs.
Therefore it is not necessary to pass parameters directly when attaching the event, since those parameters either do not change anyway, or if the parameters are dynamically created, those dynamic parameters can be read out in the function "testevent ".