Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript]Tinymce nie działa onkeyup.
Forum PHP.pl > Forum > Przedszkole
cykcykacz
Witam,
mam problemy ze zdarzeniem onkeyup.
Mam edytor tinymce i w tej textarenie chcę dodać nowe zdarzenie aby funkcja test() się odpalała ale niechce.
Firebug nic mi nie pokazuje, próbowałem bez tinymce i działa wiecie może co jest nie tak?

[JAVASCRIPT] pobierz, plaintext
  1. tinyMCE.init({
  2. mode : "textareas",
  3. theme : "advanced",
  4.  
  5. content_css: 'szymon.css',
  6.  
  7. formats: {
  8. smallcaps: {inline : 'span', 'classes': 'small-caps', styles : {fontvariant : 'small-caps'}},
  9. },
  10.  
  11. theme_advanced_buttons1 : "mybutton,bold,italic",
  12. theme_advanced_buttons2 : "",
  13. theme_advanced_buttons3 : "",
  14. theme_advanced_toolbar_location : "top",
  15. theme_advanced_toolbar_align : "left",
  16. theme_advanced_statusbar_location : "bottom",
  17. remove_linebreaks : false,
  18. entities: "160,nbsp",
  19. plugins : 'inlinepopups',
  20. plugins: 'wordcount',
  21. setup: function( ed ) {
  22. ed.addButton('smallcaps', {
  23. title: 'Small-caps',
  24. image: 'http://wordpress3.localhost/wp-content/plugins/img/letter.gif',
  25. onclick: function(){
  26. ed.focus();
  27. ed.formatter.toggle( 'smallcaps' );
  28. }
  29. });
  30.  
  31. // Highlight the smallcaps button when the cursor is on small-caps text
  32. ed.onNodeChange.add(function(ed, cm, e) {
  33. // Activates the link button when the caret is placed in a anchor element
  34. cm.setActive('smallcaps', ed.formatter.match('smallcaps'));
  35. });
  36.  
  37.  
  38.  
  39.  
  40. }
  41.  
  42. });
  43.  
  44. function test() {
  45. {
  46. var x=document.getElementById("elm1").value;
  47. var as = x.replace(/ /g, "");
  48. var ass = as.replace(/<strong>/g, "");
  49. document.getElementById('try').innerHTML= ass;
  50. alert(ass);
  51. }
  52. }
[JAVASCRIPT] pobierz, plaintext


Kod
    <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
    <textarea id="elm1" name="w" onkeyup='test();' rows="15" cols="80" style="width: 80%">
        
    </textarea>
lobopol
Z tego co kojarzę to tiny tworzy swoją warstwe do wprowadzania danych chowając textarea dlatego to nie zadziała. Musisz się podpiąć do jego boxa przykłąd z ich dokumentacji: http://www.tinymce.com/wiki.php/API3:event....Editor.onKeyUp
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.