復制代碼代碼如下:
function FCKeditor_OnComplete( editorInstance )
{
if (document.all) // IE
editorInstance.EditorDocument.attachEvent("onkeypress", FCKeditor_OnKeyup) ;
else// other browser
editorInstance.EditorDocument.addEventListener( 'onkeypress', FCKeditor_OnKeyup, true );
}
2、掛接后如果調用了fckeditor的SetHTML函數,則掛接事件會失效,要改用oEditor.EditorDocument.body.innerHTML來設置內容即可。
3、用window.event.keyCode只能取到null值,要用FCKeditorAPI.GetInstance('FCKeditor1').EditorWindow.event.keyCode。
4、按回車符后生成的是是<br>還是<p>由fckconfig.js文件里的FCKConfig.EnterMode/FCKConfig.ShiftEnterMode決定,也可動態設置但屬性名不是FCKConfig,而是Config。