OK, every other browser works fine with the method I have coded so far but for some reason Internet Explorer will not work. I have spent hours of time (more time than actually developing the feature!) on compatibility and am close to giving up!
I have a forum and one of its neat features is the WYSIWYG editor. For that, I essentially have an IFrame that acts as the document:
<iframe name='writer' src='/scripts/blank.html' class='writer'></iframe>
This is the current state of the JavaScript (constantly updated):
function initEditor() { w = frames['writer'] wc = g('writerCopy') if(w == null) return frames['writer'].document.designMode = 'on' frames['writer'].document.body.innerHTML = styleSheet+wc.value frames['writer'].focus() }
It works partially now, but fails on the line:
frames['writer'].document.body.innerHTML = styleSheet+wc.value
in Internet Explorer with ”frames.writer.document.body’ is null or not an object’.
In the end I used frames[‘frameName’].document.write(‘someText’) but only if the other method fails.