View Full Version : HTML effects inside <textarea>

09-26-2004, 05:40 PM
Can I get a few html tag effects inside a textarea?

The following code doesn't work correctly,
but it will tell what I am trying to do.

<form action="action.cfm">

<textarea name="message" rows="10">

<font color=red>This is red</font>
<font color=blue>This is blue</font>
<font color=green>This is green</font>


<input type="submit">


Thanks in Advance

09-26-2004, 06:42 PM
Might be able to do it with javascript or something, but the textarea's are text-only. HTML won't do anything in there, it'll just render as text

09-26-2004, 07:00 PM
<form action="action.cfm">
<button onclick="document.getElementById('message').style.color='red';">Red</button>&nbsp; <button onclick="document.getElementById('message').style.color='blue';">Blue</button>&nbsp; <button onclick="document.getElementById('message').style.color='green';">Green</button><br>
<textarea name="message" rows="10" id="message" style="color: red;">
This should be red until one of the buttons above is pressed.

<input type="submit">


That should work, but I'm no JavaScript expert. Unfortunately, I can't think of a way to get colors in the way you wanted. The text has to be all one color. Sorry. Perhaps the JS forum has some better answers.

09-26-2004, 11:18 PM

09-27-2004, 03:28 AM
This is crossposted at http://www.codingforums.com/showthread.php?t=45207