document.getElementById("***").contentDocument

Giganews Newsgroups
Subject: document.getElementById("***").contentDocument
Posted by:  pick…@ecreations-support.com (Eric Pickup)
Date: 29 Jul 2003

I'm having a problem with the following html (I've simplified it down
to a simple test case).  Could anyone point out why Mozilla is having
problems with this (I've tried so many variations that I can't think
of any more).  In the actual code I have an if statement to handle IE
but I need the code to work in Mozilla and IE.

<HTML>
<BODY>
<IFRAME width="100" height="100" NAME="Composition" ID="Composition">
</IFRAME>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
    var scrollwindow = document.getElementById("Composition").contentDocument;
    var page = "<P>hello</P>";
    scrollwindow.body.innerHTML = page;
//-->
</SCRIPT>
</BODY>
</HTML>

Thanks if advance for any help!
Eric

Replies