Solved

How to change/access  text in TEXTAREA         HTML/Javascript

Posted on 2006-11-01
3
5,509 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
ID: 17848648
<!-- 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
ID: 17848781
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
ID: 17848801
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

770 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