I’m trying to use document.write() to write to an iframe.document object and then access the iframe.document.body object, but it seems to be always null. I could really use some tips:
function writeContentToParamsFrame(url) {
//retrieves document content from the server using an XMLHTTPRequest object
var response = getRemoteDocumentContent(url);
//do some regex manipulation of the response
//yada yada yada
//replace the content of the iframe:
var idoc = window.frames[‘paramsframe’].document;
idoc.open();
idoc.write(response);
//override the background color from the response:
idoc.body.style.backgroundColor = getContainerBackgroundColor();
idoc.close();
}
//….. snip
<div id=”lower1content”>
<iframe id=”paramsframe” name=”paramsframe” src=”empty.htm”></iframe>
</div>
//…. snip
In IE 6.0, this works fine, but on Firefox, the idoc
The problem is that the idoc.body.style.backgroundColor fails. idoc.body is undefined. looking more into this:
idoc.GetElementsByName(“body”) returns a zero length array, so apparently, “body” does not exist?
Thanks for any help.
Steve