Solved

Detecting when a mouse leave an Iframe

Posted on 2003-11-02
9
940 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
  • 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Summernote required 3 57
Do we need servers??? 5 131
contractual requirements for app hosting 3 25
modify h2 4 10
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now