Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    77
    Thanks
    15
    Thanked 1 Time in 1 Post

    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?

  • #2
    New Coder
    Join Date
    Dec 2011
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    77
    Thanks
    15
    Thanked 1 Time in 1 Post
    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?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    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.
    Last edited by Old Pedant; 12-28-2011 at 08:56 PM.
    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.

  • Users who have thanked Old Pedant for this post:

    darnen101 (12-28-2011)

  • #5
    New Coder
    Join Date
    Mar 2008
    Posts
    77
    Thanks
    15
    Thanked 1 Time in 1 Post
    I was hoping it would be something simple like that
    Thanks a million! Now ill be able to sleep tonight.
    Much much appreciated


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •