Get the value in TextArea in JavaScript
Description
The following code shows how to get the value in TextArea.
Example
<!--from w ww. j a v a2s . com-->
<!DOCTYPE html>
<HTML>
<HEAD>
<SCRIPT>
function revString(str) {
return str;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="theForm">
Enter a text string:
<TEXTAREA name=inStr rows=5 cols=90>
</TEXTAREA>
<INPUT type=button value="Reverse String" onClick="document.theForm.results.value = revString(document.theForm.inStr.value)";>
<INPUT type=button name="theButton" value="Clear Results" onClick='document.theForm.results.value=""';>
Results<br>
<TEXTAREA name=results rows=5 cols=90>
</TEXTAREA>
</FORM>
</BODY>
</HTML>
The code above generates the following result.