View Full Version : Custom event for DIV

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

var menu = document.getElementById(menuId);
if (menu.onMenuOpen != null) {
menu.style.left = (shift == null) ? 0 : shift
menu.style.display = "inline";
currentMenuId = menuId;

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?


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum