Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > A question about textarea

Reply
Thread Tools

A question about textarea

 
 
aaabbb16@hotmail.com
Guest
Posts: n/a
 
      11-11-2007
the code is like following:
<textarea cols=40 rows=10 name=n style="overflow:auto"> this is a test
about textarea and see how it works..... </textarea>
can i assign a variable to rows based on my contents length? or
javascript has any internal attribute i can use?
TIA.
st

 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      11-11-2007
On Nov 11, 5:50 pm, (E-Mail Removed) wrote:
> the code is like following:
> <textarea cols=40 rows=10 name=n style="overflow:auto"> this is a test
> about textarea and see how it works..... </textarea>
> can i assign a variable to rows based on my contents length? or
> javascript has any internal attribute i can use?


Do you want to make it once on page loading or at any time after page
loaded?

 
Reply With Quote
 
 
 
 
aaabbb16@hotmail.com
Guest
Posts: n/a
 
      11-11-2007
On 11 11 , 6 58 , VK <(E-Mail Removed)> wrote:
> On Nov 11, 5:50 pm, (E-Mail Removed) wrote:
>
> > the code is like following:
> > <textarea cols=40 rows=10 name=n style="overflow:auto"> this is a test
> > about textarea and see how it works..... </textarea>
> > can i assign a variable to rows based on my contents length? or
> > javascript has any internal attribute i can use?

>
> Do you want to make it once on page loading or at any time after page
> loaded?


It is html builder to create a html file. The reason is my content
change often. sometimes may be just
one line or two, if set row=10, it wast more space.
what I basic idea is use string length to check my contents (may use a
function to check it), then based on that assign a var. to rows. Is
it possible? also if the content is longer that 10 rows, use
scrollbar.

 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      11-11-2007
On Nov 11, 6:28 pm, (E-Mail Removed) wrote:
> It is html builder to create a html file. The reason is my content
> change often. sometimes may be just
> one line or two, if set row=10, it wast more space.
> what I basic idea is use string length to check my contents (may use a
> function to check it), then based on that assign a var. to rows. Is
> it possible? also if the content is longer that 10 rows, use
> scrollbar.


>From the usability point of view your idea doesn't sound appealing:

one often opens a small HTML document to make it big - say to
replace the default template with her own code. By shrinking the
default textarea you are complicating the future editing. It is also
silly to ask before page load "are you making a few changes in this
puny text or it's gonna get big?" or something. So I would serve some
default "fit-the-most" textarea, say cols="72" rows="16", and maybe I
would provide a "maximize" button in the menu to make the textarea as
big as possible.
In either case you are manipulating .cols and .rows property of
textarea to change its size after the page finished loading, like

<form method="post" action="">
<textarea name="HTMLSource" cols="72" rows="16"></textarea>
<input type="button" value="Extent" onclick="
this.form.HTMLSource.rows = 20;
">
</form>


 
Reply With Quote
 
aaabbb16@hotmail.com
Guest
Posts: n/a
 
      11-11-2007
On 11 11 , 7 43 , VK <(E-Mail Removed)> wrote:
> On Nov 11, 6:28 pm, (E-Mail Removed) wrote:
>
> > It is html builder to create a html file. The reason is my content
> > change often. sometimes may be just
> > one line or two, if set row=10, it wast more space.
> > what I basic idea is use string length to check my contents (may use a
> > function to check it), then based on that assign a var. to rows. Is
> > it possible? also if the content is longer that 10 rows, use
> > scrollbar.
> >From the usability point of view your idea doesn't sound appealing:

>
> one often opens a small HTML document to make it big - say to
> replace the default template with her own code. By shrinking the
> default textarea you are complicating the future editing. It is also
> silly to ask before page load "are you making a few changes in this
> puny text or it's gonna get big?" or something. So I would serve some
> default "fit-the-most" textarea, say cols="72" rows="16", and maybe I
> would provide a "maximize" button in the menu to make the textarea as
> big as possible.
> In either case you are manipulating .cols and .rows property of
> textarea to change its size after the page finished loading, like
>
> <form method="post" action="">
> <textarea name="HTMLSource" cols="72" rows="16"></textarea>
> <input type="button" value="Extent" onclick="
> this.form.HTMLSource.rows = 20;
> ">
> </form>


Let me further explain it.
I provide a textarea (say this textarea within a table tag)to content
designer. she/he can type anything she/he wants and return back it to
my html builder and it automatic create a standard html page and
upload it to any viewers using IE.
I do not give any button to IE viewers to change this page.
just let them to view it.
Since i can not predict content desinger how many line she/he
write to this textarea for every time. the worst case is that content
designer maybe write only one line. the rows i set is rows=10. so
viewers may see this page not pretty. (for example next day this page
may updated because content designer change content to seven lines.)
My html builder is automatic tool. not need manual chang it. That is
why I need to assign a var to rows attribute. or you may have diff
solutions.
Thanks a lot!
st

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add </textarea> within <textarea> tags? frank.moens@gmail.com Javascript 1 07-04-2007 04:00 PM
Textarea Inside of a textarea wperry1@gmail.com ASP General 6 02-05-2006 08:00 AM
form textarea style question... Mel HTML 1 02-03-2004 10:01 PM
Removing carriage returns from <textarea></textarea> input Augustus ASP General 1 09-10-2003 04:55 AM
Re: basic textarea question Jukka K. Korpela HTML 0 07-15-2003 10:01 AM



Advertisments