Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set the height of a TEXTAREA

Status
Not open for further replies.

VBGuy2112

Programmer
Feb 19, 2002
58
US
Hello.

I'm looking to size a textarea to be as large as the value that is populating it. This will be a read-only textarea. I'd just display the value in a table but I loose the carriage returns, spacing, etc.

I've been able to say:
STYLE="overflow: Show;Width: 85%;"

which sets the width but when I put in a height value (Height: 100%), it show the textarea with a 0 height. Is there anyway to have this textarea be as tall as it needs to display it's value?

Thanks!
 
You can do this in JavaScript and display it in a table. If it is read only, you must supply the value somehow, so I'll assume you call the value the_val.

<script>
<!--
the_val=the_val.replace(&quot; &quot;,&quot;&nbsp;&quot;);
the_val=the_val.replace(&quot;\n&quot;,&quot;<br>&quot;);
the_val=the_val.replace(&quot;\r&quot;,&quot;<br>&quot;);
//-->
</script>

Then just write the value of the_val into the table.

Rick
 
That's a good idea. How could I test for line-feeds in VBScript? (I'd rather do it in that if I can).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top