Thread: IFrames and CSS

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    4
    Rep Power
    0

    IFrames and CSS


    Hi

    I am have problems with the Iframe control.

    I have a iframe, in the iframe is a page with some controls on. Now what i want to do is hide this iframe, I do this by using the css atribute visibility: hidden; I hide a div that surrounds the iframe. What hapens is that the iframe disapears and all the contents, but any controls in the iframe remain visable.

    Now if i take all the controls out of the form and try again, it works fine everything disapears.

    I have attached an example in a zip file, there is a pge with an iframe and a button, the iframe contents is google.com when you click the hide button you can see the problems

    Any help would be aprecated. Thanks
    Attached Files
  2. #2
  3. No Profile Picture
    miaWalczak
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    London
    Posts
    86
    Rep Power
    19

    which browser are you testing in


    camsoft...which browser are you looking at this is in as i have looked in IE 5.00 and works fine....this may indicate where your solution lies...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    4
    Rep Power
    0
    IE6 and I Think IE 5.5
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2001
    Posts
    1,882
    Rep Power
    19
    Here is a different method:

    <script>
    function hide(el)
    {
    document.getElementById(el).style.visibility='hidden';
    }
    </script>

    </head>
    <body>

    <div id="I_Leaders" name="I_Leaders">
    <iframe id="iframe1" class="InlineBdr" width="600" height="200" border="0" frameborder="no" src="http://www.google.com"></iframe>
    </div>

    <input onclick="hide('I_Leaders')" type="button" value="Hide Inline Frame">
  8. #5
  9. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    You could also try setting the height and width of the iframe to 0, or set the display property to none.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    4
    Rep Power
    0
    Thanks for your help, this solution work very well.

IMN logo majestic logo threadwatch logo seochat tools logo