Entry
How do I get width of TEXTAREA without forcing an inline or CSS WIDTH attribute?
Jun 2nd, 2005 06:13
Sebastian Pfistershammer, jsWalter,
With IE6 you can use
document.forms[0].myTextarea.clientWidth and
document.forms[0].myTextarea.clientHeight
as initial values and
document.forms[0].myTextarea.scrollWidth or
document.forms[0].myTextarea.scrollHeight
when more text has been entered (which value changes depends
on "wrap=...").
These values are also useful if you want to limit the number of lines
and not only the number of characters of your textarea.
example:
if (document.forms[0].myTextarea.scrollHeight > document.forms
[0].myTextarea.clientHeight)
{
alert("to much lines");
}