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

  •  06-11-2009, 4:18 PM

    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
View Complete Thread