Solved

Detecting when a mouse leave an Iframe

Posted on 2003-11-02
9
1,007 Views
Last Modified: 2010-08-05
Please check http://www.visionsimulations.com/portal/index.htm   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?

Roger
0
Comment
Question by:rdavis101
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 12

Expert Comment

by:Dean OBrien
ID: 9670766
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);" ..............

Easynow
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9671474
0
 

Author Comment

by:rdavis101
ID: 9672464
Easynow,

Works, but results in some strange behavior...it 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);"   ?

Zontar,

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

Roger
0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 11

Expert Comment

by:Zontar
ID: 9672589
"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.
0
 

Author Comment

by:rdavis101
ID: 9672766
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.
0
 
LVL 2

Accepted Solution

by:
mleeb earned 125 total points
ID: 9674725
Simple Solution:

Apply an OnMouseOut event to the iframe declaration.

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

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

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.
0
 

Author Comment

by:rdavis101
ID: 9676237
Mleeb,

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

Thanks much...it 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. :)
0
 
LVL 12

Expert Comment

by:Dean OBrien
ID: 9677205
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.

Easynow
0
 

Author Comment

by:rdavis101
ID: 9679220
Dude, you're right...it 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. :)

Roger
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question