471,350 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Table size

Hello

I have a table that I am trying to get the size of:

document.getElementById("tblmain").height

But if I don't set the height of the table, the statment above returns
nothing. I have text that is dynamicaly created and I want to know the
height of the table once the text has been entered in the table.

Thanks for any help!

JD

Jul 23 '05 #1
3 2722
f1******@gmail.com wrote:
Hello

I have a table that I am trying to get the size of:

document.getElementById("tblmain").height

But if I don't set the height of the table, the statment above returns
nothing. I have text that is dynamicaly created and I want to know the
height of the table once the text has been entered in the table.

AFAIK, there is no such attribute as table height.
You could place the table in a <div>, I believe then you may divine the
height.
Mick

Jul 23 '05 #2
f1cra...@gmail.com wrote:
Hello

I have a table that I am trying to get the size of:

document.getElementById("tblmain").height

But if I don't set the height of the table, the statment above returns nothing. I have text that is dynamicaly created and I want to know the height of the table once the text has been entered in the table.

Thanks for any help!

JD


http://www.mozilla.org/docs/dom/domr...8.html#1027994

Jul 23 '05 #3
<f1******@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hello

I have a table that I am trying to get the size of:

document.getElementById("tblmain").height

But if I don't set the height of the table, the statment above returns
nothing. I have text that is dynamicaly created and I want to know
the
height of the table once the text has been entered in the table.


<body onload="alert(document.getElementById('tblmain').o ffsetHeight);">
<table id="tblmain"><tr><td>THIS IS A TEST</td></tr></table>

Seems to work in IE 6.0.2900 (other versions untested), Firefox 1.0.3
(other versions untested), Mozilla 1.0.2 and 1.7.7 (other versions
untested), Opera 7.54 and 8.0 (other versions untested) - all under
Windows.

It gives slightly different results for the Gecko-based browsers.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Craig | last post: by
11 posts views Thread by Norman L. DeForest | last post: by
10 posts views Thread by Bing Wu | last post: by
15 posts views Thread by kimi | last post: by
7 posts views Thread by Shawn B. | last post: by
8 posts views Thread by Ron | last post: by
139 posts views Thread by ravi | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.