Detecting when a mouse leave an Iframe

Please check   When the page loads, drop down one of the menus in the bottom frame. Now mouseover the picture buttons in the top frame. Notice that the menu in Iframe at the bottom flickers. I don't want this to happen. I want to turn off the menu in the bottom Iframe on mouseout. But I don't know that it's my pages that are displayed in the Iframe, since this is a portal page. So I think I need to detect this event from inside the page displayed in the Iframe. But how?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dean OBrienCommented:
Try this,

put this at the end of your script:

var to;

and adjust your div's to:

<div onMouseout="to=window.setTimeout('HideMenus()',100)" onMouseover = "window.clearTimeout(to);" ..............

rdavis101Author Commented:

Works, but results in some strange always hides the menu DIV in a certain amount of time, even if the mouse is still over the menu DIV. Should I add onMousemove="window.clearTimeout(to);"   ?


Sadly, I haven't advanced far enough to understand cross-browser Javascript and CSS. Maybe someday.

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

"Someday" is already here. Start hitting the specs -- you'll find that the version 5+ browsers are about 85-90% interoperable now, and the differences are MUCH easier to bridge then when Dinosaurs Roamed The Ea-- I mean, when NS4 and MSIE4 were new.
rdavis101Author Commented:
Yup, I agree totally with you, it's just that I'm not actually a web developer or web designer. I just have a limited amount of time. Maybe I can get to it in a couple of months.
Simple Solution:

Apply an OnMouseOut event to the iframe declaration.

    <IFrame id="ContentFrame" name="Content" frameborder="0" scrolling="auto" src="content.htm">

    <IFrame id="ContentFrame" name="Content" frameborder="0" scrolling="auto" src="content.htm" onMouseOut='ContentFrame.HideMenus();'>

In order for this to work properly remove all instances of the killMenu variable and if statements referring to killMenu in your javascript, it honestly is serving no purpose besides complicating the code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rdavis101Author Commented:

Went through and stripped out the timer routine and the KillMenu variable, added your suggestion to the iFrame tag and it worked.

Thanks ocurred to me that the onmouseout event could be added to the Iframe tag, but I thought that would generate a javascript error. And it does, but I clear the error by adding window.status=' ' right after the call the HideMenus in the iframe. So it works. :)
Dean OBrienCommented:
I have just checked the page and experience the same problem  i.e. menu flickering when you mouse over the images at the top.

Note: in your code where you have added the window.status='', you need to contain the onmouseout with " character,  not ' character.

rdavis101Author Commented:
Dude, you're was still messed up. I tell ya, I love this place. I get so much help here. I just uploaded the fix. Thanks for noticing that. :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.