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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show a Var in TEXTAREA

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,

How can I show the Variable 'the_name' in a textarea? Like the one below?



var the_name = "hello hello hello";

<textarea name=&quot;ErrorReport&quot; cols=&quot;40&quot; rows=&quot;3&quot;>&quot;the_name&quot;</textarea>
 
<textarea name=&quot;ErrorReport&quot; cols=&quot;40&quot; rows=&quot;3&quot;>&quot;the_name&quot;</textarea>
<SCRIPT> <!--
var the_name = &quot;hello hello hello&quot;;
document.all.ErrorReport.innerHTML = the_name;
// -->
</SCRIPT>
 
This should work:
Code:
document.formname.ErrorReport.value = the_name;
If you want to add additional text to the value in the textarea (I do this for debugging sometimes) use:
Code:
document.formname.ErrorReport.value += &quot;\nmore text&quot;;
document.formname.ErrorReport.value += &quot;\nmore text&quot;;
document.formname.ErrorReport.value += &quot;\nmore text&quot;;
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top