2015-06-11 40 views
0

定義配置我有以下的CKEditorCKEditor的:在頁面

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %> 

<CKEditor:CKEditorControl ID="txtHtmlText" BasePath="~/Scripts/ckeditor/" 
     Toolbar="Bold|Italic|Underline|Strike|Subscript|Superscript|- |TextColor|BGColor|Font|FontSize 
JustifyLeft|JustifyCenter|JustifyRight|Justify|-|Outdent|Indent|- |NumberedList|BulletedList 
Cut|Copy|Paste|PasteText|PasteFromWord|-|HorizontalRule|Link|Unlink|- |Source|About"runat="server"></CKEditor:CKEditorControl> 

我想覆蓋的CKEditor的config.js定義字數限制一個ASP.net用戶控件。我在.ascx文件中使用了以下代碼,並且出現錯誤

「未捕獲的ReferenceError:CKEDITOR未定義」。請幫助

<script type="text/javascript"> 

    CKEDITOR.replace('txtHtmlText', 
{ 
    wordcount: { 
     // Whether or not you want to show the Paragraphs Count 
     showParagraphs: false, 

     // Whether or not you want to show the Word Count 
     showWordCount: false, 

     // Whether or not you want to show the Char Count 
     showCharCount: true, 

     // Whether or not you want to count Spaces as Chars 
     countSpacesAsChars: false, 

     // Whether or not to include Html chars in the Char Count 
     countHTML: false, 

     // Maximum allowed Word Count, -1 is default for unlimited 
     maxWordCount: 500, 

     // Maximum allowed Char Count, -1 is default for unlimited 
     maxCharCount: 500 
    } 
}); 
</script> 

回答

0

@Vinayak Prabha,

嘗試通過維克拉姆的建議。然而,一個問題?

CKEditor ID「txtHtmlText」是服務器ID,如果您必須在Java腳本中使用,您應該使用客戶端ID。

嘗試這樣

var ckEditorClientID = "#<%=txtHtmlText.ClientID %>";

CKEDITOR.replace(ckEditorClientID,