Support forums
in

setHTML doesn't work in firefox on load of page

Last post 09-25-2013, 8:00 PM by athadu. 3 replies.
Sort Posts: Previous Next
  •  06-11-2009, 9:27 AM 53003

    setHTML doesn't work in firefox on load of page

    Hello.
    I just bought CuteEditor today...
    I have this problem, when I make a setTimeout on the beginning of a load of a page, then Firefox error console says:

    editor1.setHTML is not a function
     
    It's really really odd... it works in Internet explorer.
     
    Does anybody have any ideas?
     
    Raf
    Filed under: ,
  •  06-11-2009, 11:08 AM 53016 in reply to 53003

    Re: setHTML doesn't work in firefox on load of page

    Raf,
     
    Can you create a simple example showing the problem and post the code here?
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-11-2009, 4:18 PM 53032 in reply to 53016

    Re: setHTML doesn't work in firefox on load of page

    okay here is a small example...
     
    function loadData(editdata, pri2, navn2) {
     http.open('get', 'loadLister/loadData.php?edit=' + editdata + '&ms='+new Date().getTime(), true);
     http.onreadystatechange=visdata;
     http.send(null);
     }
     
    function setHTML() {
     var editor1 = document.getElementById('CE_Editor1_ID');
     editor1.setHTML(document.getElementById('info').innerHTML); 
    }
     
    function visdata() {
     if(http.readyState == 4) {
      if (http.status == 200) {
       var response2 = http.responseText;
       document.getElementById(loading).innerHTML = response2;
       setHTML();
      } 
     }
    }
     
    I simplified the example here...
    at the beginning of each page I load some info from ajax the loaddata() function. the result comes through visdata() and loads some html, that should go to the editor through the setHTML() method... this doesn't work on startup in Firefox, it says 'editor1.setHTML is not a function' in the Firefox debugger... but when I click a button and run loaddata() again, it works...
    I tried with setTimeout too, Timeout setHTML and/or loaddata(), but didn't help. I tried loading the setHTML in the loaded file 'loadLister/loadData.php' but didn't help, tried even javascript eval this way, but no results... I don't know why it does that... but works the second time, when loaddata() is manually executed...
     
    Raf
  •  09-25-2013, 8:00 PM 78020 in reply to 53032

    Re: setHTML doesn't work in firefox on load of page

    If it helps anyone - following is the code that I have which I think is working in an ASP.NET MVC app.  This function gets called on a $(document).ready.  Notice that the code checks if the editor 'is ready'.  If not, it is calling the same method again after 10 milliseconds on a 'settimeout' - until it finds the editor is ready.

     

    var responseInitialized = false;

    function initializeEditorText() {
           var contentEditable = '<%= repsonseEditable%>';
           if (("" + contentEditable).toLowerCase() == 'true') {

               if (responseInitialized == true) {
                   return;
               }
               var editor1 = $(".myEditor");
               if (editor1 != null) {
                   if (editor1.length > 0) {
                       if (editor1[0].IsReady && editor1[0].setHTML != null) {

                           setEditorText("" + $("#responseText")[0].value);
                           responseInitialized = true;
                           sizeForm();
                           $('.myEditor').resize(function () { sizeForm(); });
                       }
                       else {
                           alert('will be trying initializeEditorText one more time in 10 milliseconds!');
                           setTimeout(function () { initializeEditorText(); }, 10);
                       }
                   }
               }
           }
       }

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems