html help

Discussion in 'Blazers OT Forum' started by TradeNurkicNow, Jul 11, 2010.

  1. TradeNurkicNow

    TradeNurkicNow piss

    Joined:
    Sep 16, 2008
    Messages:
    5,196
    Likes Received:
    676
    Trophy Points:
    113
    Occupation:
    hell
    Location:
    shit
    Hey guys,

    trying to build a website with at least an attempt at cross compatibility between firefox and IE.

    So, one thing I've noticed is that they both treat body onLoad differently.

    I've got an iframe and I'm changing its src to an html at a click of a button. The html it loads has an onLoad that tells the parent frame to change the iframe dimensions to match the content. This works fine, until you click the button more than once, at which point it will stay with the previously loaded dimensions. This ONLY happens in Firefox. IE works fine and the dimensions load properly. I can only assume it's due how firefox handles onload, or perhaps something to do with caching. I am pretty lost. Got any ideas, denny?

    top page
    Code:
    <a href="foo.html" target="iframeID">click</a><br>
    <iframe src="" id="iframeID" width="100%" height="0"></iframe>
    
    loaded page
    Code:
    <script language="JavaScript" type="text/javascript">
    function resize()
    {
    var PageHeight = foo.scrollHeight;
    parent.document.getElementById('iframeID').style.height=PageHeight;
    
    var PageWidth = foo.scrollWidth;	
    parent.document.getElementById('iframeID').style.width=PageWidth;
    }
    </script>
    <html>
    <body id="foo" onLoad="resize()">
    blah blah blah
    </body>
    </html>
    
     
  2. Denny Crane

    Denny Crane It's not even loaded! Staff Member Administrator

    Joined:
    May 24, 2007
    Messages:
    72,978
    Likes Received:
    10,673
    Trophy Points:
    113
    Occupation:
    Never lost a case
    Location:
    Boston Legal
  3. TradeNurkicNow

    TradeNurkicNow piss

    Joined:
    Sep 16, 2008
    Messages:
    5,196
    Likes Received:
    676
    Trophy Points:
    113
    Occupation:
    hell
    Location:
    shit
    argh thats what you told me last time.

    stupid jquery >:
     
  4. Denny Crane

    Denny Crane It's not even loaded! Staff Member Administrator

    Joined:
    May 24, 2007
    Messages:
    72,978
    Likes Received:
    10,673
    Trophy Points:
    113
    Occupation:
    Never lost a case
    Location:
    Boston Legal
    jQuery provides a bunch of low level DOM manipulation functions that work cross browser.

    Looking at your code,


    var PageHeight = foo.scrollHeight;


    foo is never defined.
     
  5. Eastoff

    Eastoff But it was a beginning.

    Joined:
    Jun 17, 2009
    Messages:
    16,057
    Likes Received:
    4,034
    Trophy Points:
    113
    Location:
    Tualatin
    tip: give up on html.
     
  6. TradeNurkicNow

    TradeNurkicNow piss

    Joined:
    Sep 16, 2008
    Messages:
    5,196
    Likes Received:
    676
    Trophy Points:
    113
    Occupation:
    hell
    Location:
    shit
    ok ok i'm working on learning jquery now.

    wish i had started this before i built my site :(
     
  7. Natebishop3

    Natebishop3 Don't tread on me!

    Joined:
    Sep 17, 2008
    Messages:
    94,033
    Likes Received:
    57,170
    Trophy Points:
    113
    Location:
    Portland, OR
    HTML is old technology.
     
  8. TradeNurkicNow

    TradeNurkicNow piss

    Joined:
    Sep 16, 2008
    Messages:
    5,196
    Likes Received:
    676
    Trophy Points:
    113
    Occupation:
    hell
    Location:
    shit
    YES html sucks but at least SOME is required to build a website dammit.

    I still don't see how i can do what I'm doing with jquery instead of iframes.... but i suppose I'll keep reading and I may think of something
     
  9. Denny Crane

    Denny Crane It's not even loaded! Staff Member Administrator

    Joined:
    May 24, 2007
    Messages:
    72,978
    Likes Received:
    10,673
    Trophy Points:
    113
    Occupation:
    Never lost a case
    Location:
    Boston Legal
    If you're trying to resize the iframe to be the size of the browser window, you can do that from the top level document.

    $('iframe-id').setAttribute('width', whatever).setAttribute('height', whatever);
     

Share This Page