posted 14 years ago
Thanks for the answers so far and my apologies for the unthoughtful asked question. Below a code snippet which should clarify a bit.
with line 13 commented, out clicking the "click me" (why cant this be an <a href=.. btw?) will add functions to the mouseover and mouseout event of the red box. So without a click nothing happens, first click will nicely alert the count on the mouseout. The count is increased by one with every move into the red box. Second click will show alert 2 times and the count will be increased by 2, a third click will alert 3 times and delta will be three. This behavior is undesired, I only want two functions on the hover which will be replaced every time I hit "click me"
So I thought to be clever and I uncommented line 13, which I hoped, would remove the existing function from the mouseover and mouseout events and attach new functions to it. But that only works first time, second time I hit "click me" entering and leaving the red box doesn't do a thing.
Where did I go wrong? And what can I do to replace the functions on the "hover" instead of "piling them up"?
regards,
Jeroen Dijkmeijer.
PS This example does not show the need for the replacement of functions in the hover element, but in my real project, that need certainly exists!
PPS safari and firefox give same results.