How to get the height of a td?

J

jpmorin196

Hi im working on a web project for school and i cant get something
working...

I have a graph that i would like the height to be dynamic depending on
the height of a cell in a table (td)

the td has an id and no defined height because it is not fixed and can
be different.

i have tried many things and it always give me 0 (offsetHeight,
innerHeight...)

Anyone can help me?

Thank you!
 
J

Jim Higson

Hi im working on a web project for school and i cant get something
working...

I have a graph that i would like the height to be dynamic depending on
the height of a cell in a table (td)

the td has an id and no defined height because it is not fixed and can
be different.

i have tried many things and it always give me 0 (offsetHeight,
innerHeight...)

Anyone can help me?

clientHeight?

Btw, you can see all the javascript properties of any element using the
Firefox DOM inspector.
 
B

BootNic

Hi im working on a web project for school and i cant get something
working...

I have a graph that i would like the height to be dynamic depending
on the height of a cell in a table (td)

the td has an id and no defined height because it is not fixed and
can be different.

i have tried many things and it always give me 0 (offsetHeight,
innerHeight...)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
function getHeight(){
alert(document.getElementById('ex1').offsetHeight);
}
</script>
<title></title>
</head>
<body>
<table summary="" border="1">
<tbody>
<tr>
<td id="ex1" onclick="getHeight()">example</td>
</tr>
</tbody>
</table>
</body>
</html>
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
Hi im working on a web project for school and i cant get something
working...

I have a graph that i would like the height to be dynamic depending on
the height of a cell in a table (td)

the td has an id and no defined height because it is not fixed and can
be different.

i have tried many things and it always give me 0 (offsetHeight,
innerHeight...)

Anyone can help me?

Thank you!

Is there anything in the cell to begin with and is the table positioned?
(-A working/demo url would help.)
 
J

Jonathan N. Little

It doesnt work, it returns me 0 again... :(
Did you try BootNic's example? Works in MSIE5.0+ NN7.1+ Moz & FF and
Opera...

Now it will not work in legacy 4.x browsers and fails in the WebTV/MSN
TV views, so what are you testing with? Lets see a URL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top