I have a submenu that appears when you put the mouse over the menu, is properly working in Chrome and in IE but is not working on Firefox.
Here's where the function to show the sub menu is called.
<div id="nav1">
<table>
<tr>
<td style="width: 400px;" class="navItem"
onmouseover="showSubMenu(this, 'subMenu1');">
</td>
</tr>
</table>
</div>
<div id="subMenu1" class="nav1SubMenu" onmouseover="cancelBubble();">
{code to show the list of options }
</div>
and here's the function that shows and hide the sub menu
function showSubMenu(pCell, pSubMenu){
var subMenu = document.getElementById(pSubMenu);
var unionCell = document.getElementById("unionCell");
var offsetElem = pCell;
var offsetTop = null;
var offsetLeft = null;
while (offsetElem.parentNode){
if (offsetElem.tagName != "DIV"){
offsetTop += offsetElem.offsetTop;
offsetLeft += offsetElem.offsetLeft;
}
offsetElem = offsetElem.parentNode;
}
pCell.className = "hover"
subMenu.style.left = (offsetLeft) + "px";
subMenu.style.top = (offsetTop + pCell.offsetHeight - 1) + "px";
subMenu.style.display = "block";
activeMenu = pCell;
activeSubMenu = subMenu;
cancelBubble();
document.getElementById("document").onmouseover = hideSubMenu;
}
function hideSubMenu(){
var subMenu = activeSubMenu;
subMenu.style.display = "none";
activeMenu.className = "navItem";
cancelBubble();
document.getElementById("document").onmouseover = hideSubMenu;
}
function cancelBubble(){
if (window.event){
window.event.cancelBubble=true;
}
The submenu appears and hides correctly in IE and Chrome, but is not showing in Firefox
here's the complete html
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<div id="document">
<div id="head" class="headerBackground_Local">
<div id="nav1">
<table>
<tbody>
<tr>
<td class="navItem" style="width: 200px;">
<td style="width: 100px;"></td>
<td class="navItem" onmouseover="showSubMenu(this, 'subMenu1');" style="width: 400px;">
<td style="width: 10px;"></td>
<td class="navItem" style="width: 50px;"></td>
<td style="width: 100px;"></td>
<td class="navItem" style="width: 100px;"></td>
<td style="width: 135px;"></td>
</tr>
</tbody>
</table>
</div>
<div id="subMenu1" class="nav1SubMenu" onmouseover="cancelBubble();" style="left: 274px; top: 129px; display: none;">
<table cellspacing="0" cellpadding="0" border="0">
</div>
<div id="fade" class="overlay"></div>
<div id="dialogWin" class="floatWin">
</body>
</html>