Results 1 to 4 of 4

Thread: Javascript (Iframe)

  1. #1
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript (Iframe)

    Hi

    Im trying to use an iframe, I dont really like them, but in this situation i really need to use them. Im trying to make them so that the user wont realise its there, One thing that gives it away is when it loads it shows a white background so it gives it away.

    Is there anyway to make it so that the user wont realise its there, i believe that GMAIL uses frames.

    I was thinking of using Javascript but im not sure, I use the transparency but it still shows the white bg

    this is what im using

    <iframe src="tabpane.html" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe>
    If you have any suggestions or a way to get round this please do so.

    Thank you

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is a toughie. Anyone else that knows better feel free to jump in. Anyways, I don't think there is a way to do what you want, for slow connections and older browsers that load frames and iframes slowly even on highspeed connections. However, with a modern browser and highspeed connection, you could initially load a blank page with your preferred color background into the iframe. Put this where you want your iframe:


    Code:
    <noscript><iframe src="tabpane.html" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe></noscript><script type="text/javascript"><!--
    document.write('<iframe name="switch" id="switch" src="blank.htm" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe>');
    if (document.getElementById)
    window.onload="document.getElementById('switch').src='tabpane.html'";
    else if (document.all)
    window.onload="document.switch.src='tabpane.html'";
    //-->
    </script>
    Untested. You might also want to look into setting the initial alpha and -moz- opacities to 0 and onload changing them to 100 and 1 (respectively).

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default Opacity Method

    I tried this out, seems to work. Example Here is my code:

    HTML Code:
    <html>
    <head>
    <title>Opacity Test</title>
    
    <style type="text/css"><!--
    #switch{FILTER:alpha(opacity=0);-moz-opacity:0.00;}
    --></style>
    </head>
    <body bgcolor="#d0d0d0">
    <noscript><iframe frameborder=0 scrolling=no src=leaves.html width=450px height=500px></iframe></noscript>
    <script type="text/JavaScript"><!--
    document.write('<iframe frameborder=0 scrolling=no id=switch src=leaves.html width=450px height=500px></iframe>')
    function show_iframe(){
    if (document.all){
    document.getElementById('switch').filters[0].opacity=100;
    }
    else if(document.getElementById){
    document.getElementById('switch').style.MozOpacity=1.0;}
    return;
    }
    window.onload=show_iframe
    //-->
    </script>
    </body>
    </html>
    Last edited by jscheuer1; 03-24-2005 at 10:53 PM.

  4. #4
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey guys
    Thank you both for helping out.

    jscheuer1 that was great it worked like a charm, thanks again

Bookmarks

Posting Permissions

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