Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Nov 2006
    Posts
    1,939
    Tokens
    0

    Latest Awards:

    Default Extenable iframe? =S

    I need help doing extenable iframe could someone give me a tutorial on this please or can someone help!

  2. #2
    Join Date
    Dec 2006
    Posts
    115
    Tokens
    0

    Default

    Hey there,

    There's no tutorial needed to make an expandable iframe. You have to get a Javascript code and insert it just before your iframe code.

    Code:
    <script type="text/javascript">
                //<![CDATA[
                window.onload = function() {
                    var f = document.getElementById("mainframe");
                    function resize() {
                        var h = "";
                        var w = "";
                        if (f.contentDocument) {
                            h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
                            // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
                        } else if (f.contentWindow) {
                            h = f.contentWindow.document.body.scrollHeight + 5 + "px";
                        } else {
                            return;
                        }
                        f.setAttribute("height",h);
                        f.parentNode.setAttribute("height",h);
                    }
                    if (window.addEventListener) {
                        f.onload = resize;
                    } else if (f.attachEvent) {
                        f.attachEvent("onload", resize);
                    } else {
                        return;
                    }
                    resize();
                }
                //]]>
                        </script>

    Just remember to name your iframe mainframe otherwise it won't work
    Last edited by alarmclock; 24-12-2006 at 02:27 PM.

  3. #3
    Join Date
    Nov 2006
    Posts
    1,939
    Tokens
    0

    Latest Awards:

    Default

    Hmm.. soo then my iframe html will be <iframe src="main.html" name="mainframe" width="" height="" frameborder="0"></iframe> ??

  4. #4
    Join Date
    Dec 2006
    Posts
    115
    Tokens
    0

    Default

    yup

    put id="mainframe" in there aswell, after name="mainframe"

  5. #5
    Join Date
    Nov 2006
    Posts
    1,939
    Tokens
    0

    Latest Awards:

    Default

    am really confuse atm >____< LOOL can you show me a example?

  6. #6
    Join Date
    Dec 2006
    Posts
    115
    Tokens
    0

    Default

    thinkhabbo used to have it.

    first you need a layout capable of expanding.

  7. #7
    Join Date
    Dec 2005
    Posts
    2,992
    Tokens
    1,531

    Latest Awards:

    Default

    Quote Originally Posted by Winterjai View Post
    am really confuse atm >____< LOOL can you show me a example?
    Code:
    <script type="text/javascript">
                //<![CDATA[
                window.onload = function() {
                    var f = document.getElementById("mainframe");
                    function resize() {
                        var h = "";
                        var w = "";
                        if (f.contentDocument) {
                            h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
                            // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
                        } else if (f.contentWindow) {
                            h = f.contentWindow.document.body.scrollHeight + 5 + "px";
                        } else {
                            return;
                        }
                        f.setAttribute("height",h);
                        f.parentNode.setAttribute("height",h);
                    }
                    if (window.addEventListener) {
                        f.onload = resize;
                    } else if (f.attachEvent) {
                        f.attachEvent("onload", resize);
                    } else {
                        return;
                    }
                    resize();
                }
                //]]>
                        </script>
    <iframe src="main.html" name="mainframe" id="mainframe" width="" height="" frameborder="0"></iframe>
    That went fast.

  8. #8
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    example is on colin-roberts.net i use expandable iframes..

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  9. #9
    Join Date
    Dec 2006
    Posts
    115
    Tokens
    0

    Default

    Source always after the name and id Nick :eusa_naug

    Code:
     <script type="text/javascript">
                //<![CDATA[
                window.onload = function() {
                    var f = document.getElementById("mainframe");
                    function resize() {
                        var h = "";
                        var w = "";
                        if (f.contentDocument) {
                            h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
                            // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
                        } else if (f.contentWindow) {
                            h = f.contentWindow.document.body.scrollHeight + 5 + "px";
                        } else {
                            return;
                        }
                        f.setAttribute("height",h);
                        f.parentNode.setAttribute("height",h);
                    }
                    if (window.addEventListener) {
                        f.onload = resize;
                    } else if (f.attachEvent) {
                        f.attachEvent("onload", resize);
                    } else {
                        return;
                    }
                    resize();
                }
                //]]>
                        </script>
    <iframe name="mainframe" id="mainframe"  src="main.html" 
    width="" height="" frameborder="0"></iframe>
    Last edited by alarmclock; 24-12-2006 at 02:54 PM.

  10. #10
    Join Date
    Dec 2005
    Posts
    2,992
    Tokens
    1,531

    Latest Awards:

    Default

    Long time since I've done this stuff
    That went fast.

Page 1 of 3 123 LastLast

Posting Permissions

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