Followup-to: comp.lang.javascript only
...[something.htm]
<div id=work>hello</div>
...[somethingelse.htm]
<IFRAME id="thisframe" src="./something.htm"></IFRAME>
<script>
document.frames("thisframe").getElementById("work").innerHTML =
- frames collection are a property of the window object, not of the
document.
- you can access a single frame within the frames collection with
frames["FrameName"] or with frames.FrameName but not with
frames("IframeId"). You're confused in the correct way to access a frame.
- when accessing a frame, the returned object is a window object, not a
document.
- contentDocument is a property of the iframe object which can return a
reference to the document contained in the iframe. So assuming:
<iframe id="idIframe" ...></iframe>
then you can access such iframed document like this:
document.getElementById("idIframe").contentDocument
"goodbye"
</script>
Thank you
<head>
....
<script type="text/javascript">
function PopulateIframe()
{
var IframedDocumentBody = frames["thisframe"].document.body;
var FirstParg = document.createElement("p");
FirstParg.appendChild(document.createTextNode("goodbye"));
IframedDocumentBody.appendChild(FirstParg);
}
</script>
</head>
<body onload="PopulateIframe();">
....
Not tested but should work in Mozilla-based browsers.
DU
Followup-to: comp.lang.javascript only