Click to See Complete Forum and Search --> : Table's Height


soniyakapoor03
January 30th, 2006, 04:50 AM
hi,
How to get Table's Height on loading the page.

wildfrog
January 30th, 2006, 01:20 PM
Do you mean how to get height of the table when rendered?

Consider this HTML page:

<html>
<body>
<table id="tbl" height="100%" width="100%" bgcolor="#eeff00">
<tr><td>table</td></tr>
</table>

<script language="javascript">
window.alert(document.getElementById("tbl").height);
</script>

</body>
</html>

Here a simple javascript will get the table height and show it in a dialog box. The problem is that the height you'll get is "100%". So, it won't tell you the actual height, just that it will fill "100%" of the page height.

Now, there might be better solutions to this, but 'many years' ago I made a workaround involving a java applet and 'Live Connect'. I made an empty applet that was embeded into the table (width = "1px", height="100%"). Now the applet would fill the tables height. Then using live connect I asked the applet 'what is your height?'. The results from the appelt was in pixels, and gave a more 'usable' result.

- petter

PeejAvery
January 30th, 2006, 01:46 PM
Please do not start extra threads over the same questions you have asked in other threads. This causes flooding and can slow down the servers.

As wildfrog pointed to, unless you specify the height in the original source code, you will not be able to get the height. If you set it dynamically you could also but you would already know the height because you set it.