offsetHeight  
Retrieves the height of the <TABLE> relative to the layout or coordinate parent, as specified by the offsetParent property. clientHeight  
Retrieves the height of the <TABLE> without taking into account any margin, border, scroll bar, or padding that might have been applied to the <TABLE>. height  
Sets or retrieves the height of the <TABLE>. e.g.
<TABLE id=theTable BORDER=1 WIDTH=80%>
<THEAD>
<TR>
<TH>Heading 1</TH>
<TH>Heading 2</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>Row 1, Column 1 text.</TD>
<TD>Row 1, Column 2 text.</TD>
</TR>
<TR>
<TD>Row 2, Column 1 text.</TD>
<TD>Row 2, Column 2 text.</TD>
</TR>
</TBODY>
</TABLE>
<script>
alert(document.all.theTable.offsetHeight)
</script>

解决方案 »

  1.   

    offsetWidth  包括 border 的宽度
    clientWidth  不包括 border 的宽度
      

  2.   

    <TABLE id=theTable BORDER=1 WIDTH=80%>
    <THEAD>
    <TR>
    <TH>Heading 1</TH>
    <TH>Heading 2</TH>
    </TR>
    </THEAD>
    <TBODY>
    <TR>
    <TD>Row 1, Column 1 text.</TD>
    <TD>Row 1, Column 2 text.</TD>
    </TR>
    <TR>
    <TD>Row 2, Column 1 text.</TD>
    <TD>Row 2, Column 2 text.</TD>
    </TR>
    </TBODY>
    </TABLE>
    <script language="JavaScript">
     var oRect = theTable.getBoundingClientRect();
     var nTabHeight = oRect.bottom - oRect.top;
     alert(nTabHight);
    </script>