i’ve got a .net page with a table sitting in it that has no specified height.
I want to be able to grab the height of a specific table (ID=“printIntro”). Firefox spits out a number, but IE regardless of version spits out a big fat 0.
from what i understood, IE should be able to understand offsetheight, no?
here’s a snippet of a VERY simplified version of what .net generates, as you will see IE will return 0:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function changetablewidths(id) {
if(!document.getElementById || !document.getElementById(id)) return;
var myTable = document.getElementById(id);
var tableheight = parseInt(myTable.offsetHeight);
alert(tableheight)
}</script>
</head>
<body >
<form name="aspnetForm" method="post" action="history2.aspx?print=true" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm" style="display: inline">
<table style="width: 100%; height: 100%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="height:100%">
<table style="width: 840px; height: 100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="greyBG" style="width: 798px; height: 100%" align="left" valign="top">
<table style="width: 798px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table style="width: 798px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 778px;" align="left" valign="top">
<table style="width: 778px;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table style="width: 778px;" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td style="width: 440px;">
<table style="width: 440" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" style="width: 15px;"> </td>
<td align="left" valign="top" style="width: 408px">
<!--ControlPlace Holder Starts-->
<table border="0" cellpadding="0" cellspacing="0" style="width:408px;">
<tr>
<td align="left" valign="top"><img src="http://localhost:50007/www/images/trans.gif" alt="" style="height: 15px; width:1px" /></td>
</tr>
<tr>
<td>
<table id="printIntro" style="width: 516px;" border="0" align="center" cellpadding="0" cellspacing="0" class="container">
<tr>
<td class="header">
<p>Historical Profile </p>
</td>
</tr>
<tr>
<td class="intro_mid"> Join us for a trip back in time as we explore our roots and milestones from the beginning in 1971 to the present.</td>
</tr>
<tr>
<td class="introfooter"> </td>
</tr>
</table>
<table style="width: 516px;" border="0" align="center" cellpadding="0" cellspacing="0" class="container">
<tr>
<td class="header">
<p>1990</p>
</td>
</tr>
<tr>
<td class="middle">
<div class="fun"> <img src="../flashobjects/timelinepics/1990.jpg"> </img> </div>
<div class="bodytxt">
<h1>Milestones</h1>
<ul>
<li> 120,000 clients.</li>
<li>, with more than 7,000 clients on the new service, which provides the payment of payroll taxes and automatic filing of payroll tax returns.</li>
</ul>
</div>
</td>
</tr>
<tr>
<td class="footer"></td>
</tr>
</table>
<table style="width: 516px;" border="0" align="center" cellpadding="0" cellspacing="0" class="container">
<tr>
<td class="header">
<p>1991</p>
</td>
</tr>
<tr>
<td class="middle">
<div class="fun"> <img src="../flashobjects/timelinepics/1991.jpg"> </img> </div>
<div class="bodytxt">
<h1>Milestones</h1>
<ul>
<li>its 20th anniversary.</li>
</ul>
<h1>New Products and Services</h1>
<ul>
<li>Services, its fourth new division in five years, offering products and services including employee handbooks, insurance, employee evaluations and testing tools, and section 125 plans.</li>
</ul>
<h1>Awards and Accolades</h1>
<ul>
<li><b>"200 Best Small Companies in America," </b> <i>Forbes</i> magazine.</li>
</ul>
</div>
</td>
</tr>
<tr>
<td class="footer"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" class="contentnorblue"><img src="http://localhost:50007/www/images/trans.gif" alt="" style="width: 17px; height:1px" /></td>
</tr>
<tr>
<td align="left" valign="top" > </td>
</tr>
</table>
<script type="text/javascript">changetablewidths('printIntro')</script>
<!--ControlPlace Holder Ends-->
</td>
<td align="right" valign="top" style="width: 17px;"> </td>
</tr>
<tr>
<td> </td>
<td align="center" class="smallcontentboldb"> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td style="width: 21px; height: 100%" align="left" valign="top"> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
please don’t comment about the horrible use of tables, we are working on transitioning to a css driven site…but for now this is what i’m working with.
thanks for the help.