View Full Version : Tell location of scrollbars in textarea?

06-22-2008, 06:32 PM
I've tried these properties of the textarea element:

They effectively tell me when the text has overflowed where it causes there to be scrollbars in the textarea. However, I need to know the location of scrollbars themselves. How can I know where the scrollbar stands in its scrolling range? I have no idea if the user has scrolled halfway down the textarea, not scrolled at all, or when they start to scroll.

How can i tell the location of the scrollbar (width or height) in a textarea?

-thanks http://bstats.freehostia.com/b.gif

06-23-2008, 06:48 PM
There wouldn't be any JavaScript-style methods to gain such information. But you can do it manually with a Windows Based Program called Magnifier. If you have windows, search for Magnifier.exe and then open it. If you could open the Internet Explorer file of your little HTML file, you can use magnifier to see how many pixels accross the scrollbar there are, and even how far away from the left it is. It might not be the best way, but it is the only way I know of doing it.


06-23-2008, 08:57 PM
returns the distance in pixels from the top of the element to the top of the viewing point: document.getElementById("textarea").scrollTop

06-23-2008, 10:14 PM
thanks everyone... this is a great reference site for all of these methods as well: