I am trying to create a small text editor i.e. the user inputs text in a textarea and then start to make different effects to the text, e,g make a text portion bold or italic or underline and I did this sucessfully, the only effect that I do not know how to write its script is to insert bullets in the textarea, so I wonder if anybody can help me creating a javascript that is fired when the user clicks on the button of inserting bullets.

I used the following code to give the bold effect to the text:
<code>
function fBold (textEl)
{
var range=document.selection.createRange();
if (textEl.createTextRange && textEl.caretPos)
{
var caretPos = textEl.caretPos;
caretPos.text =
caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
text + ' ' : ("<b>"+range.text+"</b>");
}
}
</code>

and then I call the function as
<code>
<input name="Button" type="button" onClick="fBold(this.form.txt_SComment);" value="Bold">
</code>

Question:I need to create a javascript that inserts bullets when the user clicks a bullet button.

Thanks a lot