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 2 of 2

Thread: Hi Please Help

  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Hi Please Help

    Hi guys, it seems my code is not compatible to chrome, and firefox, while working just fine in IE 8.

    Can you help me to write that differently?

    Code:
    <script language="JavaScript">
    <!--
    function calcHeight()
    {
      //find the height of the internal page
      var the_height=
        document.getElementById('the_iframe').contentWindow.
          document.body.scrollHeight;
    
      //change the height of the iframe
      document.getElementById('the_iframe').height=
          the_height;
    }
    //-->
    </script>

  • #2
    Regular Coder Common's Avatar
    Join Date
    Jan 2009
    Location
    Glasgow, UK
    Posts
    133
    Thanks
    16
    Thanked 13 Times in 13 Posts
    2 minor things occur to me as possible solutions when looking over that, although equally it's possible that neither will help:

    1. I've heard in the past utterances that contentWindow and contentDocument are sometimes uncompatible with various browsers etc, so try using contentDocument and see if that helps any.

    2. Modify the style of the element instead of it's "height", i.e. .style.height=the_height rather than just height. Similarly for scrollHeight (maybe... I avoid iframes so it's not a property i've ever had to use so don't quote me on that one.)

    Hopefully one of those might help.

    Edit: Oh, i just noticed, use <script type="text/javascript">, language="Javascript" is archaic. I doubt that's causing the problem but gotta keep up with standards.
    Last edited by Common; 12-20-2010 at 02:18 PM.


  •  

    Posting Permissions

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