Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Autosize Iframe

  1. #1
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Autosize Iframe

    Hi!

    I created simple script that redimensiona my iframe, in the IE functions, but in the Mozilla Firefox not.

    Script:

    HTML Code:
    function resizeIframe() {
    	alt = document.getElementById("conteudo");
    	frm = parent.document.getElementById("ibracont");
    	
    	frm.height = alt.offsetHeight;
    	alert("Iframe id=bracont: "+frm.height+" Table id=conteudo: "+alt.offsetHeight);
    }
    Click here to show a example.

    1, Click in "Fale Conosco"
    2, Click in "Enviar"
    3, Click in "Voltar"

    It noticed that the main page did not bring up to date the iframe? Why in Firefox it does not function?

  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

    It is working. Since you have no border on the iframe, there is no way visually to determine its size. The problem is that the table on the top page:

    HTML Code:
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    having its height set to 100%, remains large, even when the iframe later shrinks. To see this, add this to your stylesheet:

    Code:
    #bra_cont {
    border:1px solid black;
    }
    Then try it out, you will see that the iframe resizes just fine.
    Last edited by jscheuer1; 06-30-2006 at 05:56 PM. Reason: punctuation
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    Your script seem do what I need. Is it possible to get a copy ? and if possible how I have to install it.

    Regards

  4. #4
    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

    DD has this script:

    http://www.dynamicdrive.com/dynamici...iframessi2.htm

    As for the code used by thescente, you would have to try contacting him/her to see. For purely experimental purposes, you could view the source of the demo thescente posted a link to and get the code that way.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    HI

    I already tried this script but if I want as it works, I have to refresh the page each time see example http://brosseau.qc.ca/nouveau/header.html

    link l'entreprise / Notre équipe and link liquidation

  6. #6
    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

    You can't put the iframe inside a table with its width set to 100%. Better still is not to put it inside any table. Try the script out on an otherwise empty page, to at least get the hang of it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi guys, this works fine in IE but can't get it to function in Opera. Any ideas?

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

  9. #9
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Yeah, Iframe works but not the autosizing.
    Working fine in IE and Firefox, I'm completely lost.

  10. #10
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Excuse the second quote I misread your source. Your code looks different initially to what I have so I clearly have done something wrong.

    It works fine for all pages except Forum unless I switch to IE or FF any ideas mate?

    CQBScotland

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
  •