how to use onmouseenter and onmouseleave? Is it the same way as onmouseover and onmouseout?Could you please descript more details? Thanks!
<BODY> <div TYPE="text" NAME="" onmouseenter="this.style.background='#3399FF';alert('I am over it!');" onMouseLeave="this.style.background='#FFFFFF';alert('I am leave now!!');"> Here ar e 'onmouseenter' and 'onmouseleave' test</div> <div TYPE="text" NAME="" onmouseover="this.style.background='#3399FF';alert('I am over it!');" onmouseout="this.style.background='#FFFFFF';alert('I am leave now!!');"> Here ar e 'onmouseover' and 'onmouseout' test</div> </BODY> </HTML>
var childMenu = eval(subMenu.menu); -------------------------------^ Where is this parm come from? try alert(subMenu.menu); in you function, check out if it is a object or undefined.
to xuStanly(黑金) Yes, you are right. subMenu.menu is undefined.How to define a function variable here?Thanks
How about alert(subMenu); I just wonder why you need to write down var childMenu = eval(subMenu.menu); in your script.Maybe you can try var childMenu = eval(subMenu);
1. onmouseout="hideMenu('search_submenu', 'search_href'); -> onmouseout="hideMenu('search_submenu', 'search_href');"2. childMenu.style.visibility = "hiden"; -> childMenu.style.visibility = "hidden";3. var childMenu = eval(subMenu.menu); -> var childMenu = eval(subMenu); or -> var childMenu = eval(subMenu).children[0];
onmouseover() works now, but the <Table> I opened while onmouseover do not stay, since I have several controls in the table, when I try to do something for the control, the submenu(actually like a popup) dispear.I could not operate the controls in popup?How to make the popup stay?
try onblur() or onmouseleave() instead of onmouseout()
onblur() the submenu didn't hidden, always stay there.onmouseleave() the same result as onmouseout().Do i need to add any code in hideMenu function?
one way for this problem is checking if the mouse is within the element when the onmouseout event was fired
According my research, the onmouseover Event work fine, but the onmouseout Event has a mysterious "bug". If the menu's inner structure is too complex, as your mouse cursor moves on the child nodes of the menu, it will trigger onmouseout Event. Obviously, that is not the result we expect. Even we set the cancelBubble as "false" can not stop that. So we got a logcial "bug". In order to figure it out, we need to tell the program if the cursor actually "move out of the target".
To ice_berg16(寻梦的稻草人) Could you please give an example about how to check if the mouse is within the element when the onmouseout event was fired? To yorkane() How to tell the program if the cursor move out of the target?Thanks a lot!
To yorkane() No, that's not a bug, it's the real logic of IE's onmouseout event as shown following:if (event.fromElement!=event.toElement && this.contains(event.fromElement)) fire onmouseout ...so just as ice_berg16() shown, m$ recommend: use onmouseenter instead of onmouseover and onmouseleave instead of onmouseout in pair
<div TYPE="text" NAME="" onmouseenter="this.style.background='#3399FF';alert('I am over it!');" onMouseLeave="this.style.background='#FFFFFF';alert('I am leave now!!');"> Here ar e 'onmouseenter' and 'onmouseleave' test</div>
<div TYPE="text" NAME="" onmouseover="this.style.background='#3399FF';alert('I am over it!');" onmouseout="this.style.background='#FFFFFF';alert('I am leave now!!');"> Here ar e 'onmouseover' and 'onmouseout' test</div>
</BODY>
</HTML>
-------------------------------^
Where is this parm come from?
try
alert(subMenu.menu);
in you function, check out if it is a object or undefined.
alert(subMenu);
I just wonder why you need to write down
var childMenu = eval(subMenu.menu);
in your script.Maybe you can try
var childMenu = eval(subMenu);
onmouseout="hideMenu('search_submenu', 'search_href');
-> onmouseout="hideMenu('search_submenu', 'search_href');"2.
childMenu.style.visibility = "hiden";
-> childMenu.style.visibility = "hidden";3.
var childMenu = eval(subMenu.menu);
-> var childMenu = eval(subMenu);
or -> var childMenu = eval(subMenu).children[0];
onblur() or onmouseleave()
instead of onmouseout()
checking if the mouse is within the element when
the onmouseout event was fired
Even we set the cancelBubble as "false" can not stop that.
So we got a logcial "bug".
In order to figure it out, we need to tell the program if the cursor actually
"move out of the target".
Could you please give an example about how to check if the mouse is within the element when the onmouseout event was fired?
To yorkane()
How to tell the program if the cursor move out of the target?Thanks a lot!
No, that's not a bug, it's the real logic of IE's onmouseout event as shown following:if (event.fromElement!=event.toElement && this.contains(event.fromElement))
fire onmouseout ...so just as ice_berg16() shown, m$ recommend:
use onmouseenter instead of onmouseover and
onmouseleave instead of onmouseout in pair