How to get actual <td> height after displaying (rendering)

N

Netx

I need to know in Java Script the height of the <td id="FlashTKD"
(...)>. I declared is with height="100" but I see that sometimes
it is larger than my declaration. Is it possible to get the
height after rendering in JavaScript?
Currently I have the following code:
"<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
function infoTkd(textstring) {
var _flashtkd=document.getElementById("FlashTKD");
alert(_flashtkd.height);
}
// - End of JavaScript - -->
</SCRIPT>
(...)
<body ... onLoad="infoTkd();" ...>

However it always says "100", whereas the height is larger in my
browser window.

Thanks,
Mark
 
S

SAM

Le 12/8/08 10:02 PM, Netx a écrit :
I need to know in Java Script the height of the <td id="FlashTKD"
(...)>. I declared is with height="100" but I see that sometimes it is
larger than my declaration. Is it possible to get the height after
rendering in JavaScript?
Currently I have the following code:
"<SCRIPT LANGUAGE="JavaScript">

<!-- Beginning of JavaScript -
function infoTkd(textstring) {
var _flashtkd=document.getElementById("FlashTKD");
alert(_flashtkd.height);

try :

alert('outside = '+ _flashtdk.offsetHeight +
'\ninside = ' + _flashtdk.clientHeight);
}
// - End of JavaScript - -->
</SCRIPT>
(...)
<body ... onLoad="infoTkd();" ...>

However it always says "100",

of course,
that is right what you did tell to it


<https://developer.mozilla.org/en/Determining_the_dimensions_of_elements>
<http://msdn.microsoft.com/en-us/library/ms530302(VS.85).aspx>
<http://www.quirksmode.org/dom/tests/elementdimensions.html>
<http://www.quirksmode.org/dom/w3c_cssom.html>

<http://www.quirksmode.org/js/findpos.html>
 
D

dhtml

Netx said:
I need to know in Java Script the height of the <td id="FlashTKD"
(...)>. I declared is with height="100" but I see that sometimes it is
larger than my declaration. Is it possible to get the height after
rendering in JavaScript?
Currently I have the following code:
"<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

This comment isn't really necessary, is it?
function infoTkd(textstring) {
var _flashtkd=document.getElementById("FlashTKD");
alert(_flashtkd.height);
}
// - End of JavaScript - -->
</SCRIPT>
(...)
<body ... onLoad="infoTkd();" ...>

However it always says "100", whereas the height is larger in my browser
window.

the height property will return the value of the height attribute given
in the HTML. Don't use height attribute; use css instead.

The clientHeight property includes padding. If padding on the TD is 0,
the clientHeight property will give the height of the content area.

Garrett
 
N

Netx

the height property will return the value of the height
attribute given in the HTML. Don't use height attribute; use
css instead.

The clientHeight property includes padding. If padding on the
TD is 0, the clientHeight property will give the height of the
content area.

Thanks for support.
BTW is there a way to get x,y position of <td
id="FlashTKD"> within a browser document's window?
Because I have a javascript menu which need positionTop and
horizontal position as a parameter.
 
S

SAM

Le 12/10/08 4:53 PM, Netx a écrit :
BTW is there a way to get x,y position of <td
id="FlashTKD"> within a browser document's window?

Did you have a look to the links I give in my last post ?
 
D

dhtml

SAM said:
Le 12/10/08 4:53 PM, Netx a écrit :

Did you have a look to the links I give in my last post ?

By "browser document's window", you might mean the ICB.

Quirksmode explanations on "how to find an element's position" are
misleading/wrong. The example code will work in only the simplest cases.

It is a better idea to not try to find the position from the browser
window or root, but instead find an alternate solution.

Garrett
 
T

Thomas 'PointedEars' Lahn

dhtml said:
By "browser document's window", you might mean the ICB.

What is "the ICB"? Do you mean by that what is usually called the viewport?


PointedEars
 
D

dhtml

Thomas said:
What is "the ICB"? Do you mean by that what is usually called the viewport?

Yeah, that's what I meant. The dimensions of the Initial Containing
Block are the same as a desktop browser's viewport.

Garrett
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top