...

View Full Version : Tell if textarea has scrollbars or not, or has 'overflowed'?



glz
06-21-2008, 04:17 AM
Let's say you have a textarea 30px by 30px, you fill it with more than 10,000 text characters. It will obvious that the scrollbars will activated because there is so much text in the small space. In other words, it 'overflowed'. Now other than common sense, is it possible to tactically tell with javascript/css when text in a textarea has overflowed, or caused there to be the appearance of of scrollbars, height scrollbars and/or width scrollbars.

If so, I'd like to see some code to achieve this.

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

mrhoo
06-21-2008, 04:23 AM
var who= some_textarea //(or any element);
var hasScroll= who.scrollHeight > who.offsetHeight;

glz
06-21-2008, 04:39 AM
hoo anks :)
I"ll try it out.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum