hi guys,
I am trying to make a simple text editor for IE and firefox using javascript. I want to know how can i bold the selected text and otehr stuff like italics and all. cause in IE i was able to do with the following lines.
[HTML]
if(document.selection){
var str=document.selection.createRange().text;
document.getElementById(txt).focus();
var sel=document.selection.createRange();
sel.text="<b>"+str+"</b>";
}
[/HTML]
But i what i am able to get for firefox is how to select the text, and how to set position of the caret using the following functions :-
[HTML]
document.getElementById(txt).selectionStart;
document.getElementById(txt).selectionEnd;
document.getElementById(x).setSelectionRange(0,3); \\to select text
[/HTML]
please help
thanks :)