The clientHeight , clientLeft , clientTop , and clientWidth Properties


The clientHeight , clientLeft , clientTop , and clientWidth Properties

These 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

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

clientHeight

           

x

x

x

x

 

Read-only

 

Type: Integer

clientLeft

           

x

x

x

x

 

Read-only

 

Type: Integer

clientTop

           

x

x

x

x

 

Read-only

 

Type: Integer

clientWidth

           

x

x

x

x

 

Read-only

 

Type: Integer

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> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net