Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-28-2011, 03:53 PM   PM User | #1
darnen101
New Coder

 
Join Date: Mar 2008
Posts: 67
Thanks: 10
Thanked 1 Time in 1 Post
darnen101 is an unknown quantity at this point
javascript event that refreshes iframe- too much refreshing!

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:
http://maybetheworldisending.com/fre...HOMEPAGE_jan4/

An example of the problematic code is as follows:
Code:
<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?
darnen101 is offline   Reply With Quote
Old 12-28-2011, 04:16 PM   PM User | #2
Ann-Marie
New Coder

 
Join Date: Dec 2011
Posts: 19
Thanks: 2
Thanked 0 Times in 0 Posts
Ann-Marie can only hope to improve
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.
Ann-Marie is offline   Reply With Quote
Old 12-28-2011, 04:29 PM   PM User | #3
darnen101
New Coder

 
Join Date: Mar 2008
Posts: 67
Thanks: 10
Thanked 1 Time in 1 Post
darnen101 is an unknown quantity at this point
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:
Code:
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?
darnen101 is offline   Reply With Quote
Old 12-28-2011, 08:49 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,249
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ummm...why not simply check WHICH iframe content is already being shown and, if it is the same, don't refresh it?

Code:
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 12-28-2011 at 08:56 PM..
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
darnen101 (12-28-2011)
Old 12-28-2011, 09:00 PM   PM User | #5
darnen101
New Coder

 
Join Date: Mar 2008
Posts: 67
Thanks: 10
Thanked 1 Time in 1 Post
darnen101 is an unknown quantity at this point
I was hoping it would be something simple like that
Thanks a million! Now ill be able to sleep tonight.
Much much appreciated
darnen101 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:40 AM.


Advertisement
Log in to turn off these ads.