0

当在 FCKeditor 2 textarea 中输入内容时,我需要触发自定义 javascript 函数。但是,我进行了广泛的搜索,但找不到答案。想以某种方式将 onkeypress="customfunction()" 添加到文本区域。

谢谢你的帮助!

4

2 回答 2

1

最后通过一些提示找到了一些东西。下面是如何在 FCKeditor 2.0 上执行 onkeypress。您需要在调用编辑器代码后加载此 javascript:

function FCKeditor_OnComplete(editorInstance){   
    if (document.all) {        // If Internet Explorer.
      editorInstance.EditorDocument.attachEvent("onkeydown", function(event){alert('key was pressed');} ) ;
    } else {                // If Gecko.
      editorInstance.EditorDocument.addEventListener( 'keypress', function(event){alert('key was pressed')}, true ) ;
    }

}
于 2010-11-25T21:21:45.920 回答
0

这似乎有效:

CKEDITOR.instances.<yourEditorname>.document.on('key', function(event) { });

在这里找到: http ://cksource.com/forums/viewtopic.php?t=18286

于 2010-11-25T21:12:05.967 回答