I am writing a javascript + HTML program to edit a textarea like the one above when posting a thread. Simply I am adding a Bold, Underline and Italics button like any other editor to edit a text area, but I am building it myself. I can extract the selected text and all the text. I can change all the text in theElement to B,U and/or I. But I want to be able to select a portion of the text and ammend it accordingly. I need to know how to extract a substring from theElement object, ammend it accordingly and then display it again in the textarea. Below is a function that is called when the Bold button is called. It is just a snippet of code I know that works. I am hoping you can fill in the blanks
[CODE]function eButton()
{
document.pstmess.TA1.focus();
theElement = document.getElementById(“TA1”);
theElement.style.fontWeight= ‘bold’;
/**
var str = document.selection.createRange().text;
**/
}
I