在fckeditor中按下键时触发javascript函数
我需要在FCKeditor 2 textarea中键入内容时触发一个自定义javascript函数。然而,我已经到处寻找,找不到答案。希望以某种方式向文本区域添加onkeypress=“customfunction()”之类的操作 谢谢你的帮助 这似乎有效:在fckeditor中按下键时触发javascript函数,javascript,fckeditor,onkeypress,Javascript,Fckeditor,Onkeypress,我需要在FCKeditor 2 textarea中键入内容时触发一个自定义javascript函数。然而,我已经到处寻找,找不到答案。希望以某种方式向文本区域添加onkeypress=“customfunction()”之类的操作 谢谢你的帮助 这似乎有效: CKEDITOR.instances.<yourEditorname>.document.on('key', function(event) { }); CKEDITOR.instances..document.on('key
CKEDITOR.instances.<yourEditorname>.document.on('key', function(event) { });
CKEDITOR.instances..document.on('key',函数(事件){});
在这里找到:最后通过一些单词提示找到了一些东西。下面是如何在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 ) ;
}
}