The clientHeight , clientLeft , clientTop , and clientWidth PropertiesThese properties give you the dimensions, in pixels, of an object that you've set the height, width, left position, or top position for, using CSS styles. You can see the support for these properties in Table 5.14. Table 5.14. The clientHeight , clientLeft , clientTop , and clientWidth Properties
Here's an example; in this case, the code reports the height you've set for a <P> element using that element's width style: (Listing 05-07.html on the web site)<HTML> <HEAD> <TITLE> Using the clientHeight Property </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function getText() { alert("document.all.text1.clientHeight = " + document.all.text1.clientHeight) } // --> </SCRIPT> </HEAD> <BODY> <H1>Using the clientHeight Property</H1> <P NAME="text1" ID="text1" STYLE="width:200"> Here's the text. </P> <FORM NAME="form1"> <INPUT TYPE="BUTTON" VALUE="Click Me!" ONCLICK="getText()"> </FORM> </BODY> </HTML> |