Page 1 of 1

Submenu help

Posted: Thu Dec 01, 2005 3:32 pm
by Pineriver
Trying to create a submenu with a tables and divs from a db, when the mouse is
rolled onto a item a submenu would expand using onmouseover and closed again using
onmouseout.

I got everything worked out but the only thing I cant get to work
is on the <div> that expands the main menu, the onmouseout is being activated
when the mouse is being moved over the sub menus which are the
<tr> and not the main menu <div>.

This is the basic jist of the code that I have a problem with.

Code: Select all

<div onMouseOut="alert('Mouse is out')">
  <table width="117" height="78" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="117" height="19" bgcolor="#006699"> Sub menu 1</td>
    </tr>
    <tr>
      <td height="20" bgcolor="#006699">Sub menu 2</td>
    </tr>
  </table>
</div>


I've looked on some over submenus that others have created and they use <div>
and<span>, but same problem I have gotten. Might there be a fix to this that
anyone could see?

Thanks

Posted: Wed Dec 07, 2005 4:40 am
by foobar
This is a common problem, because whenever you move your mouse over a sub-element, the DOM object changes and thus onmouseout fires.

BrainJar has a good tutorial on this:

http://brainjar.com/dhtml/events/default3.asp