View Full Version : Problem with viewing iFrame on FF and IE

06-03-2006, 10:56 AM
Hi, I am having a problem with viewing iFrame on FF and IE. It seems that i got the position correct for FF but it doesn't for IE. I have search through the forums but i feel it's the best i can do for now:( .. as I had used the previously example on this (http://www.dynamicdrive.com/forums/showthread.php?t=2388) but i had failed. Please advice on my current coding.. :o

Files being used:
bug.gif= To re-create the example above but failed.
miscTopFrame.asp= The header, footer and Nav
ls.asp= A set of banners on the side
test.htm = The contents which will appear in iframe.

Do not mind messy coding. Hope someone really shed some light on this thread so that i can complete this task and share this info to everyone.

<link href="css/style.css" rel="stylesheet" type="text/css" />
<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: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//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)
//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])

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
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)

function loadintoIframe(iframeid, url){
if (document.getElementById)

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)


<style type="text/css">

float: left;
margin: 0;
margin-right: 0;
padding: 0;

#content {
padding: 0;
margin-left: 160px;


<!--#include file="miscTopFrame.asp" -->

<table width="185" border="0">

<th scope="row"><!--#include file="ls.asp" --></th>

<div id = "bug">

<div id ="content">
<iframe id="myframe" src="test.htm" scrolling="yes" frameborder="1" width="660" height="358"vspace="50" hspace="50""></iframe>

06-03-2006, 11:58 PM
Just a guess, as I came across something similar recently. Try setting the iframe's margins to 0 (for some odd reason IE's default margins for iframes are not 0, they should be):

<iframe style="margin:0;" id="myframe" src="test.htm" scrolling="yes" frameborder="1" width="660" height="358" vspace="50" hspace="50"></iframe>

You had two closing quotes on the hspace value, and a missing space in there among the other attributes. The missing space shouldn't matter but might, I have no idea what effect extra quotes might have.

06-04-2006, 01:22 AM
Hi and thanks alot for you reply. It seems to be the closest it can get but it's not I want.. But I found another workaround by using "Scrollable IFRAME" from DD. However, it's like taking 2 steps forward and 1 step backward kind of day. Even I can able to position the same in IE & FF. I am using swishmax to create a menu to change the contents in the iframe but no success yet. Low Morale:( anyway, Thanks again.

This is the code I am refering to. Hope some1 knows how to deal with it while i go and research it.

onSelfEvent (press) {
var someURL = "./test.htm";
javascript( "frames['DATAMAIN'].location.href = '"+ someURL +"';" );