Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在fckeditor中按下键时触发javascript函数_Javascript_Fckeditor_Onkeypress - Fatal编程技术网

在fckeditor中按下键时触发javascript函数

在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

我需要在FCKeditor 2 textarea中键入内容时触发一个自定义javascript函数。然而,我已经到处寻找,找不到答案。希望以某种方式向文本区域添加onkeypress=“customfunction()”之类的操作

谢谢你的帮助

这似乎有效:

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 ) ;
    }

}