0

我在获取用 Jquery 中的 ckeditor 编写的数据 html 时遇到问题。
我无法通过 jQuery 选择数据,因为此编辑器在 $(document).ready() 之后加载文件
我获取数据并通过 $.ajax{} 发布到 db ,并显示在预览部分。
(c#/asp.net)

我的问题:
我无法获取 elementID。
我通过将 dll 添加到工具箱来使用 ckeditor。

html代码中的ckeditor

<CKEditor:CKEditorControl ID="CKEditorControl" runat="server"  
            BasePath="ckeditor" ContentsCss="ckeditor/contents.css" 
            Height="250px" 
            TemplatesFiles="ckeditor/themes/default/theme.js" FilebrowserBrowseUrl="ckeditor/plugins/FileManager/index.html" 
            FilebrowserFlashBrowseUrl="ckeditor/plugins/FileManager/index.html" FilebrowserFlashUploadUrl="ckeditor/plugins/FileManager/index.html" 
            FilebrowserImageBrowseLinkUrl="ckeditor/plugins/FileManager/index.html" FilebrowserImageBrowseUrl="ckeditor/plugins/FileManager/index.html" 
            FilebrowserImageUploadUrl="ckeditor/plugins/FileManager/index.html" 
            FilebrowserUploadUrl="ckeditor/plugins/FileManager/index.html" BackColor="#FF0066" 
                    DialogButtonsOrder="Rtl" 
                    FontNames="B Yekan; B Yekan,tahoma;Arial/Arial, Helvetica, sans-serif; Comic Sans MS/Comic Sans MS, cursive; Courier New/Courier New, Courier, monospace; Georgia/Georgia, serif; Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif; Tahoma/Tahoma, Geneva, sans-serif; Times New Roman/Times New Roman, Times, serif; Trebuchet MS/Trebuchet MS, Helvetica, sans-serif; Verdana/Verdana, Geneva, sans-serif" 
                    ResizeDir="Vertical" ResizeMinHeight="350" UIColor="#CACACA">dhd fdh</CKEditor:CKEditorControl>

谁能帮我吗?

============================
core.ckeditor.js 中的方法

getData : function()
        {
            this.fire( 'beforeGetData' );
 
            var eventData = this._.data;

            if ( typeof eventData != 'string' )
            {
                var element = this.element;
                if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
                    eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
                else
                    eventData = '';
            }

            eventData = { dataValue : eventData };
 
            // Fire "getData" so data manipulation may happen.
            this.fire( 'getData', eventData );
 
            return eventData.dataValue;
        }

描述:

{String} getData() Since: 3.0
Gets the editor data. The data will be in raw format. It is the same data that is posted by the editor. 
Defined in: core/editor.js.
if ( CKEDITOR.instances.editor1.getData() == '' )
    alert( 'There is no data available' );
Returns:
{Undefined} (String) The editor data.

我写了代码:
html:

<textarea id="editor"></textarea>

js:

var edit = CKEDITOR.replace('editor');
        alert(CKEDITOR.instances.edit.getData());

但没有发生?

4

1 回答 1

0

利用

alert(CKEDITOR.instances.<%=CKEditorControl.ClientID %>.getData());

有用。

于 2012-12-13T11:44:18.807 回答