PDA

View Full Version : Resolved onMouseout event handler


twQ
12-30-2009, 08:49 PM
Hey, I'm fixing a drop down menu script. Not complicated and I can make it work this is more curiosity. Ok the below code is the current it works, but it immediately closes. Huh? Am I misunderstanding the event handler? Please tell me how to fix it. Thanks!

EDIT: Found the error. As it turns out you cannot use a function with arguemnts (i.e. function('hey')) you must use just a function (for those that don't know just the name of the function no parenthesis)

so it would be:

element.onmouseoff = function;


that kinda sucks for my purpose but atleast I found the cause.

Tim

jscheuer1
12-31-2009, 02:39 AM
You can though, if you do it like so:

element.onmouseout = function(){myFunc('hey');};

Or even:

element.onmouseout = function(e){e = e || window.event; myFunc(e, 'hey');};

twQ
12-31-2009, 03:51 AM
Yea I figured out anonymous functions right after I posted lol. Thanks for taking the time to tell me, I'm glad I figured out what was causing my problems.