Re: Error on call to GetDocument

  •  04-20-2010, 3:59 AM

    Re: Error on call to GetDocument

    Hi Ken,
     
    your example works great on my site, as long as I call 'changeColor' in the onclick event.
     
    Now let´s say that I want the editor to change color automatically, once the page has loaded. I would try to attach the function call to the onload event of the window, like this:
     
    <script>
    var editor1 = document.getElementById("<%= Editor1.ClientID %>");  
     
    function changeColor()   
    {   
    var editdoc = editor1.GetDocument();   
    editdoc.body.style.backgroundColor="Red";
    }

    window.onload = changeColor;
    </script>
     
    Voilá: "Object doesn’t support this property or method " on 'editor.GetDocument()'.
     
    This suggests that the editor isn't completely loaded, when the window.onload event occurs. My original mission was to call a certain function whenever the editor content changes. Is there any other way to wire the editor change event, if I can´t do it in the onload event of the window?
     
    Thanks,
    Tobias
     
     
     
View Complete Thread