A question about textarea

A

aaabbb16

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
 
V

VK

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?
 
A

aaabbb16

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.
 
V

VK

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>
 
A

aaabbb16

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top