ellisd5
10-20-2008, 03:50 PM
Hi all,
I have a DHTML menu I created and I have the need to create an event so that I can make a call when the menu is opened.
The div that holds the menus contents looks like this..
<div id="favouritesMenu" onMenuOpen="openingFavouriteMenu();" />
An my open menu code looks like this
function showMenu(menuId, shift) {
if (currentMenuId != null && currentMenuId != menuId) {
// if flicked onto a differen't dropdown menu, hide the last one
doHideMenu(currentMenuId);
}
var menu = document.getElementById(menuId);
if (menu.onMenuOpen != null) {
eval(menu.onMenuOpen);
}
menu.style.left = (shift == null) ? 0 : shift
menu.style.display = "inline";
currentMenuId = menuId;
stopMenuClose();
}
Really a unelegant way of performing what I'm trying to achieve but it works in IE. Doesn't in Firefox though, menu.onMenuOpen is undefined. How can I go about creating a custom event easily?
Thanks
Dale
I have a DHTML menu I created and I have the need to create an event so that I can make a call when the menu is opened.
The div that holds the menus contents looks like this..
<div id="favouritesMenu" onMenuOpen="openingFavouriteMenu();" />
An my open menu code looks like this
function showMenu(menuId, shift) {
if (currentMenuId != null && currentMenuId != menuId) {
// if flicked onto a differen't dropdown menu, hide the last one
doHideMenu(currentMenuId);
}
var menu = document.getElementById(menuId);
if (menu.onMenuOpen != null) {
eval(menu.onMenuOpen);
}
menu.style.left = (shift == null) ? 0 : shift
menu.style.display = "inline";
currentMenuId = menuId;
stopMenuClose();
}
Really a unelegant way of performing what I'm trying to achieve but it works in IE. Doesn't in Firefox though, menu.onMenuOpen is undefined. How can I go about creating a custom event easily?
Thanks
Dale