I have a dropdown list in my navbar. I do something a little different to usual drop down lists, instead of having the drop down list created & just hidden, I create(when a link is hovered over) & destroy it(when you stop hovering over that link) dynamically using javascript.
My Problem: I am attempting to set onmouseleave on the dropdown list div(that I create in javascript). But the function that I want to be called on onmouseleave takes one parameter – how do I specify this parameter?
dropDownList.onmouseleave = onLeaveEx; // how do I specify the 1st parameter? Such as onLeaveEx("aboutUsLink")
function onLeaveEx( linkName )
{
if ( navSubMenu != null )
{
navSubMenu.parentNode.removeChild( navSubMenu );
navSubMenu = null;
}
}
Use an anonymous function: