A bit more information...
One might wonder why I would want to set the HTML of the editor before displaying it. The answer, of course, is that I don't. I want to set it immediately after displaying it...
- var div1=document.getElementById("div1");
- div1.style.display="block";
- var editor1 = document.getElementById('<%= Editor1.ClientID%>');
- editor1.setHTML("test"); // throws the error
However, if I set a timeout of 1 second on the last line of code (defining editor1 globally of course), then it works perfectly...
- var editor1;
-
- function setEditorHTML() {
- var div1=document.getElementById("div1");
- div1.style.display="block";
- editor1 = document.getElementById('<%= Editor1.ClientID%>');
- setTimeout("editor1.setHTML('test'), 1000);
- }
So it's definitely a timing thing. Apparently the editor doesn't instantiate itself, and hence make methods like setHTML available, until it is displayed. This problem does not show up if you use the visibility style instead of display, but other problems do show up then that make that approach impractical.
Aaron