Click to See Complete Forum and Search --> : Prob with Richtext Editor & Firefox, plz help.


gadapchetvoi
07-16-2008, 03:35 AM
Good morning, everyone.

I'm having big trouble with browser compatibility when trying to make a richtext Editor run on both IE & FF. I'm very glad if you can solve it.


Let's zoom in the detail : In order to run on both IE & FF, my editor must bases on "iframe" element with "designMode=on" but not "div" element.

Anyway, I have to get the range(Selection) that user selected in the Editor field , and run some function with it. With IE, this work as expected, but with FF, I can't find the way to grab the selection start Index (Position) & end Index.

I tried "editor.selectionStart" , but it seems this way's for textbox only.
I tried "editor.contentWindow.getSelection()" , but this Object doesn't have such a property like "StartPoint" , it can return the text value only.

Although I've tried whole yesterday for Googling. I'm awaiting any suggestion with high appriciate......

Tks 4 readin'

rnd me
07-16-2008, 04:12 AM
follow this advice (http://www.mozilla.org/editor/ie2midas.html)

gadapchetvoi
07-16-2008, 10:16 AM
follow this advice (http://www.mozilla.org/editor/ie2midas.html) Thanks Rnd Me for the link. It's the key to my success :) !

That it is :

document.getElementById("Editor_ID").contentWindow.getSelection().getRangeAt(0).startOffset

rnd me
07-17-2008, 10:06 AM
Thanks Rnd Me for the link. It's the key to my success :) !

That it is :

document.getElementById("Editor_ID").contentWindow.getSelection().getRangeAt(0).startOffset

glad to be useful and that you got it going.