Hi everyone,
I saw several people on this board asking for a way to handle the onKeyUp event, in order to dome some text checking as it is typed.
I asked this too, and eventually found a simple way to do that. It is achieved through the use of the FCKeditor_OnComplete function.
let's say you have a my_function() function to do whatever you want on the keyUp event.
Add this in your javascript code, in the page where the editor is created:
function FCKeditor_OnComplete( editorInstance ) { if (document.all) { // IE editorInstance.EditorDocument.attachEvent("onkeyup", my_function) ; } else { // other browser editorInstance.EditorDocument.addEventListener( 'keyup', my_function, true ) ; } }
Re: onKeyUp event handling: simple solution that works
Re: onKeyUp event handling: simple solution that works
I am working on a similar requirement. As user types in the FCKeditor, count of the characters present in FCKeditor should be displayed in another textbox.
So I want 'OnKeyUp' event to get this work done through a script.
when I tried "FCKeditor_OnComplete" method, I get "An exception of type 'Microsoft JScript runtime error: 'editorInstance' is undefined' was not handled."
Am I using it properly?
I can understand that I have to create an instance before I call this. Something like...
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
How should I proceed?
Can anyone help me out?
Re: onKeyUp event handling: simple solution that works
Re: onKeyUp event handling: simple solution that works
I was trying to build such event handler and I have issues with figuring out the actual editorInstance object that deals with the event itself.
How can I find the instance based on event object I get in handler?
Crirus
Re: onKeyUp event handling: simple solution that works
Here is my code...
function FCKeditor_OnComplete( editorInstance ) {
if (document.all) {
// IE
editorInstance.EditorDocument.attachEvent("onkeyup", callCounterUpdate) ;
} else {
// other browser
editorInstance.EditorDocument.addEventListener( 'onkeyup', callCounterUpdate, true ) ;
}
}
function callCounterUpdate()
{
alert("callCounterUpdate");
}
Nothing happens at all.
Could anyone explain what is going on here and how I might fix it to work?
Thanks you,
George.
Re: onKeyUp event handling: simple solution that works
editorInstance.EditorDocument.addEventListener( 'onkeyup', callCounterUpdate, true ) ;
Should be
editorInstance.EditorDocument.addEventListener( 'keyup', callCounterUpdate, true ) ;
Re: onKeyUp event handling: simple solution that works
====================
but when I press "Source" off and on ,so .... both in ie & ff , it's not work now..
Re: onKeyUp event handling: simple solution that works
Re: onKeyUp event handling: simple solution that works
Re: onKeyUp event handling: simple solution that works
Re: onKeyUp event handling: simple solution that works
Yeah, when u swtich to "Source" mode and swtich to "WSYIWYG" mode again, the onkeyup event will stop working .
Re: onKeyUp event handling: simple solution that works
I need some hook on keyup for multiple editor instances in the same page.
Thanks
Cris
Re: onKeyUp event handling: simple solution that works
K2.Bolgoodoh(document.getElementById("content_intro"))) ;