[thelist] TEXTAREA resizes

David Nesbitt david at grimwits.com
Fri Feb 15 13:05:01 CST 2002


----- Original Message -----
> I have a page which contains a form consisting of a large textarea and a
> submit button.  I'd like to, if possible, set the size of the textarea
> based on the client's window size, either dynamically on the client side
or
> if possible, through server side calculations.  We're using ASP for this.

Howdy, I whipped up this little script a while ago to illustrate how to
change the size of the text area. You'd just have to modify it to accept the
width you calcuate from the users browser width/height.
It only works in IE 4+, maybe Mozilla as well. Definatly not Netscape 4.7.
It's very simple to do.
Hope this helps

<script language=javascript>
<!--
 function resize_width(Add_Size) {
      window.document.branch.leaf.cols+= Add_Size;
 }
 function resize_height(Add_Size) {
      window.document.branch.leaf.rows += Add_Size;
 }
//-->
</script>

<form name="branch">
<input type=button name=Bigger value="+ Width"  onclick =
"resize_width(10);">
<input type=button name=Bigger value="+ Height" onclick =
"resize_height(10);">
<br>
<textarea cols=10 rows=10 name=leaf></textarea>
</form>

: David Nesbitt
: Web Developer (ColdFusion)
: Tundra Semiconductor
: Ottawa, ON Canada
: david at grimwits.com





More information about the thelist mailing list