Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Textarea Resize

  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Textarea Resize

    Good day to all !
    how can I let my user choose the cols and rows dynamicaly ?

    Thanks !

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Posts
    185
    Thanks
    2
    Thanked 1 Time in 1 Post
    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
    Code:
    <html><body><textarea id="textarea_bob" rows="10" cols="10"></textarea></body></html>
    object reference is commonly retrieved with document.getElementById.
    Code:
    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
    Code:
    alert(target.rows);
    or redefine the property with assingment
    Code:
    target.rows=100;
    the value can be retrieved in a similiar fashion, which you'll probably want since you mentioned user defined properties
    Code:
    target.rows=+prompt("how many rows?","");
    or maybe from its own value
    Code:
    target.rows=target.value;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •