Hello,
I have a FCKeditor on my Page. What I want to do with it, is to mark certain defined words green. That works already. Therefore I use the JavaScript API, whenever the user uses space or enter, I get the content of the editor, search for the words and replace them by a construct like <font style="color: rgb(x,y,z)" title="blabla">word</font>. Then I select the whole content and use the insertHTML method to insert the new text.
My Problem is, that if the user doesn't change at the end of the text but somewhere in between, the cursor always jumps to the end , because I select all content and replace it by the new one. Therefore I would appreciate a function to save my cursorposition and set my cursor to that position after inserting the text.
Does anybody have an idea?
Tanks for helping!
I have a FCKeditor on my Page. What I want to do with it, is to mark certain defined words green. That works already. Therefore I use the JavaScript API, whenever the user uses space or enter, I get the content of the editor, search for the words and replace them by a construct like <font style="color: rgb(x,y,z)" title="blabla">word</font>. Then I select the whole content and use the insertHTML method to insert the new text.
My Problem is, that if the user doesn't change at the end of the text but somewhere in between, the cursor always jumps to the end , because I select all content and replace it by the new one. Therefore I would appreciate a function to save my cursorposition and set my cursor to that position after inserting the text.
Does anybody have an idea?
Tanks for helping!