TextArea width

Discussion in 'Javascript' started by Liming, Jun 20, 2006.

  1. Liming

    Liming Guest

    Hi,

    I'm using a third party libray and I can drag a diveand resize it. The
    issue is, I have a textarea inside of it and I need to resize the width
    of textarea and height of textarea along with it.

    I know what the width and height of the div will be when it finishes
    dragging (in "px"), so how do I convert the width and height in "px" to
    the cols and rows of a textarea?

    thanks!

    Limign
    Liming, Jun 20, 2006
    #1
    1. Advertising

  2. Liming

    Ivo Guest

    "Liming" schreef
    > Hi,
    >
    > I'm using a third party libray and I can drag a diveand resize it. The
    > issue is, I have a textarea inside of it and I need to resize the width
    > of textarea and height of textarea along with it.
    >
    > I know what the width and height of the div will be when it finishes
    > dragging (in "px"), so how do I convert the width and height in "px" to
    > the cols and rows of a textarea?


    You don't. You specify the new sizes of the textarea in pixels, in the exact
    same way as you do with the div element. It is perhaps possible to calculate
    the number of pixls that a col or row takes up by measuring, adding a row
    and measuring again, but setting RefToTextarea.style.width = '400px'
    directly allows setting the dimensions in much finer detail.
    hth
    ivo
    Ivo, Jun 20, 2006
    #2
    1. Advertising

  3. Liming

    Liming Guest

    ah, thanks lvo. I dont' know why I didn't think about it. Just got
    stuck in that idea and never thought about setting via style property.
    THANKS. it works perfectly now.



    Ivo wrote:
    > "Liming" schreef
    > > Hi,
    > >
    > > I'm using a third party libray and I can drag a diveand resize it. The
    > > issue is, I have a textarea inside of it and I need to resize the width
    > > of textarea and height of textarea along with it.
    > >
    > > I know what the width and height of the div will be when it finishes
    > > dragging (in "px"), so how do I convert the width and height in "px" to
    > > the cols and rows of a textarea?

    >
    > You don't. You specify the new sizes of the textarea in pixels, in the exact
    > same way as you do with the div element. It is perhaps possible to calculate
    > the number of pixls that a col or row takes up by measuring, adding a row
    > and measuring again, but setting RefToTextarea.style.width = '400px'
    > directly allows setting the dimensions in much finer detail.
    > hth
    > ivo
    Liming, Jun 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. honcho
    Replies:
    3
    Views:
    6,091
    honcho
    Jul 15, 2005
  2. AndrewF
    Replies:
    1
    Views:
    744
    Bruce Barker
    Oct 10, 2005
  3. Augustus
    Replies:
    1
    Views:
    338
    Ken Schaefer
    Sep 10, 2003
  4. Textarea Inside of a textarea

    , Feb 4, 2006, in forum: ASP General
    Replies:
    6
    Views:
    315
    Anthony Jones
    Feb 5, 2006
  5. Replies:
    1
    Views:
    297
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page