Witam,
chcę aby po odciśnieciu klawisza lub wcisnieciu wykonała się funkcja.

Próbuje w ten sposób ale nie dostaję żadnego alertu ani komunikatu że coś jest nie tak.

[JAVASCRIPT] pobierz, plaintext
  1. <script type="text/javascript">
  2.  
  3. function CKEditor_OnComplete( editorInstance ) {
  4. if (document.all) {
  5. // IE
  6. editorInstance.EditorDocument.attachEvent("onkeyup", my_function) ;
  7. } else {
  8. // other browser
  9. editorInstance.EditorDocument.addEventListener( 'keyup', my_function, true ) ;
  10. }
  11. }
  12.  
  13. function my_function() {
  14. alert('hej');
  15. }
  16.  
  17. </script>
[JAVASCRIPT] pobierz, plaintext


  1. <form action="sample_posteddata.php" method="post">
  2. <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">
  3. </form>


EDIT:
W ten sposób sobie porawdzilem zamiast skryptu powyżej wystarczy ten:
[JAVASCRIPT] pobierz, plaintext
  1. <script type="text/javascript">
  2. CKEDITOR.on('instanceCreated', function(e) {
  3. e.editor.on('contentDom', function() {
  4. e.editor.document.on('keyup', function(event) {
  5. // keyup event in ckeditor
  6. alert('test');
  7. }
  8. );
  9. });
  10. });
  11. </script>
[JAVASCRIPT] pobierz, plaintext