Friday, October 08, 2004

Dynamic resize of iframe in IE 5.5 with HTML documents formatted with
tags

I did a few google searches, and there doesn't seem to have any ready-made javascript for dynamically resizing an iframe in Internet Explorer 5.5 where the document layout is done using
tags. So here is the script for that:


var dhtml_frame = document.frames(frame_id);
var dhtml_frame_doc = dhtml_frame.document;
while(dhtml_frame_doc.readyState != "complete"){};
var height = 0;
var width = 0;
for(var i = 0; i < tagname ="="> height)
{
height = dhtml_frame_doc.all[i].offsetHeight;
}
if(dhtml_frame_doc.all[i].offsetWidth > width)
{
width = dhtml_frame_doc.all[i].offsetWidth;
}
}
}
iframe.style.height = height + 20;
iframe.style.width = width + 20;

0 Comments:

Post a Comment

<< Home