[英]trigger javascript function when a key is pressed in fckeditor
當在FCKeditor 2文本區域中鍵入內容時,我需要觸發自定義javascript函數。 但是,我進行了廣泛搜索,找不到答案。 想要以某種方式將onkeypress =“ customfunction()”添加到文本區域。
謝謝你的幫助!
最終使用一些單詞提示找到了一些東西。 這是即使在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 ) ;
}
}
這似乎可行:
CKEDITOR.instances.<yourEditorname>.document.on('key', function(event) { });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.