The scrollHeight , scrollWidth , scrollLeft , and scrollTop Properties


The scrollHeight , scrollWidth , scrollLeft , and scrollTop Properties

You use the scrollHeight , scrollWidth , scrollLeft , and scrollTop properties with elements that can be scrolled, such as <BODY> and <TEXTAREA> elements. The scrollHeight and scrollWidth properties give the actual height and width of an object (no matter how much of the object is visible currently). The scrollLeft and scrollTop properties give the distance in pixels from the upper left of the scrolling area to the upper left of the object you're scrolling. You can see the support for these properties in Table 5.51.

Table 5.51. The scrollHeight , scrollWidth , scrollLeft , and scrollTop Properties

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

scrollHeight

           

x

x

x

x

 

Read-only

 

Type: Integer

scrollWidth

           

x

x

x

x

 

Read-only

 

Type: Integer

scrollLeft

           

x

x

x

x

 

Read-only

 

Type: Integer

scrollTop

           

x

x

x

x

 

Read-only

 

Type: Integer

Tip

In Internet Explorer, only a few objects supported this property; now almost all do. If the object doesn't actually support scrolling, however, these properties will always have a value of 0.




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