I'm developing a WordPress these days. I use the javascript code below to get the selected text in an active editor.
ed = FCKeditorAPI.GetInstance("content");
tag=ed.Selection.GetSelection();
However, this works well in Firefox, but it doesn't work in either IE6 or IE7.
I try to use Firebug to debug the script and I find out that the GetSelection() method returns an object and Firefox will automatically cast this object to a string, which is not the case in IE.
Then I add "alert(tag)" to the code, and in IE the alert prompt is [object] which also comfirms that IE treat the return of the GetSelection() method as an object.
Can anyone tell me how to get this work in IE?
ed = FCKeditorAPI.GetInstance("content");
tag=ed.Selection.GetSelection();
However, this works well in Firefox, but it doesn't work in either IE6 or IE7.
I try to use Firebug to debug the script and I find out that the GetSelection() method returns an object and Firefox will automatically cast this object to a string, which is not the case in IE.
Then I add "alert(tag)" to the code, and in IE the alert prompt is [object] which also comfirms that IE treat the return of the GetSelection() method as an object.
Can anyone tell me how to get this work in IE?

Re: GetSelection() not work in IE
if I replace all the GetSelection() with GetSelectedElement(), I always get null both in Firefox and IE
Re: GetSelection() not work in IE
http://www.fckeditor.net/forums/viewtopic.php?f=6&t=8814&p=23940
Re: GetSelection() not work in IE
var selection = ""; if(oEditor.EditorDocument.selection != null) { selection = oEditor.EditorDocument.selection.createRange().text; } else { selection = oEditor.EditorWindow.getSelection(); }Re: GetSelection() not work in IE
if(document.all) { tag = ed.Selection.GetSelection().createRange().text; } else { tag = ed.Selection.GetSelection(); }