Solved

How to change/access  text in TEXTAREA         HTML/Javascript

Posted on 2006-11-01
3
5,494 Views
Last Modified: 2011-08-18
HOw can I modify text in text Area.  assuming there is already some text in text aria
0
Comment
Question by:mostenscer
  • 2
3 Comments
 
LVL 30

Expert Comment

by:callrs
Comment Utility
<!-- Change text area
      2006-11-01 rs
-->
<form>
<textarea name=text1 style="width: 500px; height: 300px">
</textarea><br>
<input name=in1 value="Some text">
<input type=button value="Click to change text area" onclick="this.form.text1.value=this.form.in1.value"><br>
<input name=in2 value="Add text">
<input type=button value="Click to add to text area" onclick="this.form.text1.value=this.form.text1.value+'\n'+this.form.in2.value">
</form>

Instant Demo: http://www.sendspace.com/file/itvixp changeTextarea.htm
0
 
LVL 1

Expert Comment

by:puneetmahajan1982
Comment Utility
Run this code :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form ID="Form1">
<textarea style="width: 500px; height: 300px" ID="Textarea1">
Hello
</textarea><br>

<input value="Some text" ID="Text1">
<input type=button value="Click to change text area" onclick='document.getElementById("Textarea1").value = document.getElementById("Text1").value' ID="Button1" NAME="Button1"><br>
<input value="Add text" ID="Text2">
<input type=button value="Click to add to text area" onclick='document.getElementById("Textarea1").value =document.getElementById("Textarea1").value +"\n"+ document.getElementById("Text2").value' ID="Button2" NAME="Button2">
</form>

</body>
</html>
0
 
LVL 30

Accepted Solution

by:
callrs earned 500 total points
Comment Utility
Oops, I posted wrong link. Here's the demo: http://www.sendspace.com/file/dn3og0 changeTextarea.htm

(There's also a "Split points" link below)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope‚Ķ
Read about why website design really matters in today's demanding market.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now