View Full Version : javascript event that refreshes iframe- too much refreshing!

12-28-2011, 04:53 PM
Sorry for the title- i'm doing my best to describe my problem. So this is basically it:
I have some javascript onmouseover events that change the content of an iframe. The problem is that within the javascript calls, I have some url's attached to rollover buttons INSIDE the parent div's that are being manipulated by javascript. So the iframe refreshes properly when its supposed to, but it ALSO refreshes as each of the links inside the effected div are rolled over as well. So there is too much extra refreshing and lots of clicking noises because of the Internet Explorer default noise settings. The easiest way to see what im talking about is to go to:

An example of the problematic code is as follows:

<div class="beachcomberoff" target="mainbox" onmouseover="ShowPage('frame1_slider');this.className='beachcomberon'" onmouseout="this.className='beachcomberoff';">
<div id="turquoise1"><a href="#"></a></div><div id="coral1"><a href="#"></a></div><img src="HOMEPAGE_jan4_web/beachcomber.png" width="453" height="330" border="0"></div>

The prob is that the div's named turquoise1 and coral1 are being effected by the javascript on the containing div. How do i make it unaffected by that js? Is there something like a "onmouseover=do nothing" or something of the sort?

12-28-2011, 05:16 PM
Don't know if it will help but I had a similar problem. I created a variable named "changed" that was set true by anything on the page that would require fresh data and put an if(changed) before any of the functions you need to suppress.

12-28-2011, 05:29 PM
Thanks Ann Marie- I was trying to think of how to use a variable to fix it all but im not terribly competent when it comes to JS. I'm pretty good at manipulating scripts to fit what i need but when it comes to authoring anything new im pretty awful :P
Can you be a little more specific?
Right now the js that covers the refreshing is as follows:

function ShowPage(frame)

frames[0].location = frame+'.html'

how would i go about adding a variable here so that it wouldnt refresh the page over and over on rollovers?

Old Pedant
12-28-2011, 09:49 PM
Ummm...why not simply check WHICH iframe content is already being shown and, if it is the same, don't refresh it?

var currentContents = null;
function ShowPage(frame)
if ( currentContents != frame )
frames[0].location = frame+'.html'
currentContents = frame;

Yes, you could set it so that onmouseover the inner <div>s and/or <img>s would then throw away the mouse over event, but what about all the space in the parent <div> that is not covered by one of those inner <div>s?? After being on top of one of the inner div's, moving back off of one would re-trigger the onmouseover of the outer div.

Keep it simple.

12-28-2011, 10:00 PM
I was hoping it would be something simple like that :)
Thanks a million! Now ill be able to sleep tonight.
Much much appreciated

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum