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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open / close iframe problem

    Hi - first post so be kind!

    I have a function that shows/hides an iframe. I actually found the function on this site. Here is the structure:

    Mainpage:

    Has a link which opens a floating iframe.

    Code:
    <a href="#" onclick="HideFrameComingSoon()">Click Here</a>
    
    <iframe id="comingsoon" allowtransparency="true" style="display:none;" scrolling="no" src="comingsoon/soon1a.php"></iframe>
    <script language="javascript">
    <!--
    function HideFrameComingSoon() {
    var fr = document.getElementById ("comingsoon");
    if(fr.style.display=="none") {
    fr.style.display="block";
    }
    else {
    fr.style.display="none";
    }
    }
    -->
    </script>
    iframe :

    Code:
    <a href="" onClick="parent.HideFrameComingSoon()">Close</a>
    This is working great - except when you've opened/hidden the iframe in IE7 and then click to re-open the iframe on the main page you get a 404. Works perfectly in Firefox.

    I think it has something to do with the fact that the iframe loads a page within the /comingsoon directory and therefore IE get's confused, but I can't be sure?

    Any ideas?

  • #2
    New Coder
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, I'm not a fan of frames.

    I can't see the problem. Your aim is to open an iframe when link is clicked, then the iframe contains a link which closes the iframe? Well I tried it and it works for me in both Firefox and IE, so I'm guessing the problem lies with the comingsoon directory or something, but I'm clueless on how to solve that.
    Tom Dean

  • #3
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for giving it a go. Just to make it clear, the iframe opens (via the main link), closes(via the iframe link), then wont open again (via the main link).

    Well, it does in Firefox but not in IE7.
    Last edited by PJJames; 04-23-2007 at 01:17 PM. Reason: typo


  •  

    Posting Permissions

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