View Full Version : Textarea Resize

07-01-2006, 06:50 PM
Good day to all !
how can I let my user choose the cols and rows dynamicaly ?

Thanks !

07-02-2006, 06:31 AM
you can set almost any property 'dynamically' with simple assignment; an object reference, a dot, the property name, an equals sign, and the new value. say you're html is like so
<html><body><textarea id="textarea_bob" rows="10" cols="10"></textarea></body></html>
object reference is commonly retrieved with document.getElementById.

var target=document.getElementById("textarea_bob");

so now when you say "target" you mean whatever element has that id. use dot syntax to reference features of that object

or redefine the property with assingment
the value can be retrieved in a similiar fashion, which you'll probably want since you mentioned user defined properties

target.rows=+prompt("how many rows?","");or maybe from its own value