I have a Text Area that allows users to enter text and save it to a database. I need to change the style of only part of the text. The idea is that the user can click a button that fires some JavaScript code that appends a block of text to the TextArea that is a different Font Color and Font Name from the rest of the text in the TextArea. The following is one of my attempts.
This adds the text to the TextArea but the HTML tags are visible in the TextArea rather than the text being formatted. Any ideas how this can be done?
Thanks,
Rich
Code:
function CodeBlock() {
var sText;
var sCodeBlock;
var oElement;
oElement = frmPosts.all["txtTextArea"];
sText = oElement.value; // The text areas current text
sCodeBlock = '<BR><FONT style="font-family:CourierNew;font-color:Blue;">Type Formatted Text Here</FONT>';
sText += sCodeBlock;
alert("Value: " + sText);
oElement.value = sText;
}
Thanks,
Rich