fckeditor不在firefox中工作

时间:2010-07-12 13:59:22

标签: javascript asp.net fckeditor

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

它在IE和Chrome中工作正常但在firefox 3.6.4中无法正常工作

2 个答案:

答案 0 :(得分:1)

FireFox不使用 innerText

'innerText' works in IE, but not in Firefox

答案 1 :(得分:0)

IE使用document.all这就是为什么它支持格式,但有一个解决方法是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;
            }

现在它适用于两者