Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2008
    Posts
    110
    Tokens
    0

    Default Expanding iframe keeps changing to scroll - Anyone help

    ... As said

    Heres my code - an anyone help me out and tell me why it's adding a scrill bar lmao!

    Thanks so much!

    Code:
    <head>
    <script type="text/javascript">
    
    /***********************************************
    * IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
    * Visit DynamicDrive.com for hundreds of original DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    
    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: ["main1", "main2"] or ["main"] or [] for none:
    var iframeids=["main"]
    
    //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
    var iframehide="yes"
    
    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
    
    function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    
    function resizeIframe(frameid){
    var currentfr=document.getElementById(frameid)
    if (currentfr && !window.opera){
    currentfr.style.display="block"
    if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
    currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
    else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
    currentfr.height = currentfr.Document.body.scrollHeight;
    if (currentfr.addEventListener)
    currentfr.addEventListener("load", readjustIframe, false)
    else if (currentfr.attachEvent){
    currentfr.detachEvent("onload", readjustIframe) // Bug fix line
    currentfr.attachEvent("onload", readjustIframe)
    }
    }
    }
    
    function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot)
    resizeIframe(iframeroot.id);
    }
    
    function loadintoIframe(iframeid, url){
    if (document.getElementById)
    document.getElementById(iframeid).src=url
    }
    
    if (window.addEventListener)
    window.addEventListener("load", resizeCaller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", resizeCaller)
    else
    window.onload=resizeCaller
    
    </script>
    <title> St. Mary's Caledonian Operative - Lodge of Freemasons </title>
    
    <style type="text/css">
    
    body {
        margin: auto;
        font-family: verdana;
        font-size: 11px;
        color: #000000;
        }
    #container {
        width: 848px;
        margin: auto;
        }
    #banner {
        background-image: url(banner.PNG);
        width: 838px;
        height: 147px;
        }
    #side {
        float: left;
        margin-top: 10px;
        }
    #boxtop {
        background-image: url(boxtop.PNG);
        width: 158px;
        height: 30px;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 5px;
        }
    #midw {
        background-image: url(midw.PNG);
        width: 158px;
        height: 29px;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 5px;
        }
    #midg {
        background-image: url(midg.PNG);
        width: 158px;
        height: 29px;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 5px;
        }
    #boxbot {
        background-image: url(boxbot.PNG);
        width: 158px;
        height: 30px;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 5px;
        }
    #sidebox {
        background-image: url(sidebox.PNG);
        width: 158px;
        height: 126px;
        margin-top: 10px;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 5px;
        }
    #content {
        float: left;
        margin-top: 10px;
        margin-left: 25px;
        }
    #contop {
        background-image: url(contop.PNG);
        width: 620px;
        height: 43px;
        }
    #conmid {
        background-image: url(conmid.PNG);
        width: 610px;
        background-repeat: repeat-y;
        padding-left: 5px;
        padding-right: 5px;
        }
    #conbot {
        background-image: url(conbot.PNG);
        width: 620px;
        height: 46px;
        }
    
    
    
    
    </style>
    
    </head>
    
    <body>
    
    <div id="container">
    
    <div id="banner"></div>
    
    
    
    <div id="side">
    <div id="boxtop">
    <a href="javascript:loadintoIframe('main', 'home.htm')">Home</a>
    </div>
    
    <div id="midw">
    <a href="javascript:loadintoIframe('main', 'page1.htm')">Something1</a></div>
    
    <div id="midg">
    <a href="javascript:loadintoIframe('main', 'page2.htm')">Something2</a>
    </div>
    
    <div id="boxbot">
    <a href="javascript:loadintoIframe('main', 'page3.htm')">Something3</a>
    </div>
    
    <div id="sidebox">
    YOUR TEXT HERE! =]
    </div>
    
    
    <div id="content">
    
    <div id="contop"></div>
    
    <div id="conmid"><iframe id="main" src="externalpage.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
    
      </div>
    
    <div id="conbot"></div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    </div>
    </body>
    </html>

  2. #2
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    I cannot see any errors, perhaps just get the code off DD again, and reinsert. Have you tweaked any of it?


  3. #3
    Join Date
    Oct 2008
    Posts
    110
    Tokens
    0

    Default

    Quote Originally Posted by L?KE View Post
    I cannot see any errors, perhaps just get the code off DD again, and reinsert. Have you tweaked any of it?

    A tiny bit in a gallant effort to fix it...still didn't work.

  4. #4
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    Just redo the code again lol.


  5. #5
    Join Date
    Oct 2008
    Posts
    35
    Tokens
    0

  6. #6
    Join Date
    Oct 2008
    Posts
    35
    Tokens
    0

  7. #7
    Join Date
    Jun 2008
    Location
    West midlands, Birmingham.
    Posts
    2,093
    Tokens
    219

    Latest Awards:

    Default

    I had this problem, change width and height in the iframe code, it will then remove the scrollbars when its at the correct width/height.

    <iframe id="content" name="content" src="home.htm" style="width:100%;height:600px;" frameborder="0" onload="resizeIframe();"></iframe>

    Change were its bold P;s theres nout wrong with your code.

  8. #8
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    He wants it to expand. Setting a heigh will make it expand.

    Just follow the instructions on DD, it's not that complex


Posting Permissions

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