Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • karsten skov 8 posts 21 karma points
    Jun 23, 2010 @ 16:09
    karsten skov
    0

    Why doesn't this work in Umbraco?

    Okay, I know I'm a noob.... So here's a noob question: I've implemented a piece of code that checks how much data a given iframe has at any time, and adjust the height correspondingly. I got my code working in a plain html page but when I implement it in umbraco, it seems like the code isn't activated.

    I've tried creating a macro, and insert on a page, directly into a template. It just doesn't activate. I'm missing something ( "you think? ;0) ) could someone help me out.

    The script is:

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

    and the iframe tag like this:

    <iframe src="http://mypage/here.asp" id="it_drift" onLoad="calculateHeight();" width="336" height="1" scrolling="no"></iframe>

     

    I hope someone can help me out, it's driving me off the wall !!

  • Kevin Farrow 46 posts 67 karma points
    Jun 23, 2010 @ 17:28
    Kevin Farrow
    0

    code looks ok but you could try using:

    <script type="text/javascript" language="javascript">

    instead of

    <script language="JavaScript">

    Just a thought.... :-)

    Regards,
    Kevin

  • Chris Dunn 210 posts 401 karma points
    Jun 25, 2010 @ 02:25
    Chris Dunn
    0

    Have you dropped an alert("calculateHeight is running"); to see if the function is even being called?

    You could also try using jquery's $(document).ready() function.  It's fired right after the DOM is loaded but before all of the

    page content.

    -Chris

Please Sign in or register to post replies

Write your reply to:

Draft