Note: if you don't wait to do this after the page loads, it often doesn't work...hence I use the onload() event (which I learned from John)
<BODY onload="test()">
<IFRAME src="test.html" name="read_me_name" id="read_me"></IFRAME>
</BODY>
<script type="text/javascript">
function test()
{
var my_frame = document.getElementById("read_me");
var doc = my_frame.contentDocument;
if (doc == undefined)
{
doc = my_frame.contentWindow.document;
}
// read by id
el = doc.getElementById("read_me_too");
alert(el.innerHTML);
// read the entire contents
alert(doc.body.innerHTML);
}
</script>
(HTML source for the IFRAME)
<HTML>
<DIV id="read_me_too">
<I>Some <B>Html</B> here</I>
</DIV>
</HTML>
--
MattWalsh - 23 Mar 2007