I’m using the following code for a page, that has a drop down which calls a file in an iframe. The height usually expands to accomodate the file that is called. However, randomly it does not expand, and in stead cuts off some of the content of the iframe file.
Any thoughts?
JAVASCRIPT:
<script language=”JavaScript1.2″ type=”text/javascript” src=”/JavaScript/iframe_print.js”>
function doSel(obj)
{
for (i = 1; i < obj.length; i++)
if (obj[i].selected == true)
eval(obj[i].value);
}
function getIFRAMEdocheight(theiframe, def_height) {
var IFRAMEref = frames[theiframe];
if (IFRAMEref)
return (typeof IFRAMEref.document.body != ‘undefined’ &&
typeof IFRAMEref.document.body.scrollHeight != ‘undefined’) ?
IFRAMEref.document.body.scrollHeight :
(typeof IFRAMEref.document.height != ‘undefined’) ?
IFRAMEref.document.height :
def_height;
}
</script>
HTML CODE:
<table cellpadding=”0″ cellspacing=”0″ border=”0″ width=”556″ align=”center”>
<tr>
<td bgcolor=”597D33″></td>
</tr>
<tr>
<td bgcolor=”FFFFFF”></td>
</tr>
<tr>
<td bgcolor=”E1EDF6″ align=”right” valign=”middle”>
<table cellpadding=”3″ cellspacing=”0″ width=”100%” border=”0″>
<tr>
<td align=”right” valign=”middle”>
<FORM name=”jsMenu”>
<select name=”jsSelList” size=”1″ onchange=”doSel(this)”>
<option>- SELECT AD PRODUCT -</option>
<option value=”parent.theiframe.location.href=’/wxcom/ad_products/products/content_sponsorship.shtml'”>Content Sponsorship</option>
</select>
<a href=”javascript:void print_iframe(‘theiframe’)” title=”print” class=”bolded_link_black”>print<img src=”/images/icon_print.gif” width=”20″ height=”16″ alt=”print” border=”0″ align=”absmiddle”></a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor=”FFFFFF”></td>
</tr>
<tr>
<td bgcolor=”597D33″></td>
</tr>
</table>
<IFRAME marginheight=”0″ width=”556″ SRC=”#” TITLE=”Creative Specs” id=”theiframe” SCROLLING=”no” NAME=”theiframe” ALIGN=”center” FRAMEBORDER=”0″ onload=”theiframe.resizeTo(556,getIFRAMEdocheight(‘theiframe’,556))”></IFRAME>
</FORM>