brothercake
03-14-2004, 03:11 AM
I've got an anonymous function attached to a link, which might be activated via onclick or onmouseover - in both cases the handler opens a submenu, but if it's onclick it should return false so the link isn't followed.
Essentially:
linkObject[eventHandler] = function(e)
{
this.openMenu(e.target);
if(eventHandler == 'onclick')
{
return false;
}
}
Fine, but that generates a strict warning - "anonymous function does not always return a value".
Trouble is ... I can't return anything else except false, because then the link HREF doesn't show up in the status bar in Internet Explorer when you hover over it!
And I can't universally return false either, because events from links in nested menus won't work anymore - they'll bubble up and return false - so you won't be able to click them.
So what can I do? I just wanna get rid of that strict warning, so I guess I either need another way of phrasing that anonymous function, or I need a solution to why any other return value but false makes the links not show up in the status bar in IE.
Essentially:
linkObject[eventHandler] = function(e)
{
this.openMenu(e.target);
if(eventHandler == 'onclick')
{
return false;
}
}
Fine, but that generates a strict warning - "anonymous function does not always return a value".
Trouble is ... I can't return anything else except false, because then the link HREF doesn't show up in the status bar in Internet Explorer when you hover over it!
And I can't universally return false either, because events from links in nested menus won't work anymore - they'll bubble up and return false - so you won't be able to click them.
So what can I do? I just wanna get rid of that strict warning, so I guess I either need another way of phrasing that anonymous function, or I need a solution to why any other return value but false makes the links not show up in the status bar in IE.