日期:2014-05-17  浏览次数:20473 次

如何使用jquery更改fckeditor内容,求解
如题,对于fckeditor编辑器不是很了解,求解答

------解决方案--------------------
JScript code


function FCKeditor_OnComplete( editorInstance )
        {
            editorInstance.Events.AttachEvent('OnFocus', FCKeditor_OnFocus);
            //editorInstance.Events.AttachEvent('OnClick', FCKeditor_OnClick);
            editorInstance.Events.AttachEvent( 'OnBlur', onEditorBlur ); 
        } 
        
        function FCKeditor_OnFocus(editorInstance)//这里添加FCK聚焦事件,
        {
            var topid = "jquerywatertiptxt" + $("#<%=txtDetail.ClientID%>").attr("id");
            if ($("#" + topid).val() != "") {
                    $("#" + topid).css("display", "none");
                }
        }
        
        function onEditorBlur()
        {
            var topid = "jquerywatertiptxt" + $("#<%=txtDetail.ClientID%>").attr("id");
            var oEditor = FCKeditorAPI.GetInstance("<%=txtDetail.ClientID %>");
            if (oEditor.GetHTML().replace(/<[^>]+>/g,"") != "") {
            $("#<%=txtDetail.ClientID%>").val( oEditor.GetHTML());
                    $("#" + topid).css("display", "none");
                }else{$("#" + topid).css("display", "")}
        }

------解决方案--------------------
可以从聚焦和失去焦点 事件入手去更改内容
------解决方案--------------------
$("#fckeditor").val("abcdefg123456")