...

View Full Version : Textarea Resize



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

Thanks !

subhailc
07-02-2006, 07: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

alert(target.rows);
or redefine the property with assingment
target.rows=100;
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
target.rows=target.value;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum