views:

33

answers:

2
var oEditor = FCKeditorAPI.GetInstance("<%=FCKeditorSelfDocument.ClientID %>");
        var oDOM = oEditor.EditorDocument;
oDOM.body.innerText = 'Hello';

it is working fine in IE and chrome but not working in firefox 3.6.4

A: 

IE uses document.all that's why it supports the format but there is a work around for firefox

var oEditor = FCKeditorAPI.GetInstance("<%=FCKeditorSelfDocument.ClientID %>");
            var oDOM = oEditor.EditorDocument;
            if (document.all)
            {

                oDOM.body.innerHTML = 'hello';// for IE
            }
            else //For firefox
            {
                var geckoRange = oDOM.createRange();
                geckoRange.selectNodeContents(oDOM.body);
                geckoRange = 'hello';
                oDOM.body.innerHTML = geckoRange;
            }

now it work for both

Mac
+1  A: 

FireFox does not use innerText:

http://stackoverflow.com/questions/1359469/innertext-works-in-ie-but-not-in-firefox

rick schott