PDA

View Full Version : Expanding iframe keeps changing to scroll - Anyone help



Guttey
09-11-2008, 07:45 PM
... As said

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

Thanks so much!


<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(navigat or.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+FFextr aHeight;
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>

L?KE
09-11-2008, 08:12 PM
I cannot see any errors, perhaps just get the code off DD again, and reinsert. Have you tweaked any of it?

Guttey
10-11-2008, 07:24 PM
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.

L?KE
10-11-2008, 07:53 PM
Just redo the code again lol.

23:02
11-11-2008, 06:39 PM
Im using this iframe :

http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

23:02
11-11-2008, 06:39 PM
Im using this iframe :

http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

iDenning
12-11-2008, 05:10 PM
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.

L?KE
13-11-2008, 04:20 PM
He wants it to expand. Setting a heigh will make it expand.

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

Want to hide these adverts? Register an account for free!