irt.org Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q853 How can you dynamically write content to a floating frame (IFRAME)?

You are here: irt.org | FAQ | JavaScript | Frame | Q853 [ previous next ]

Try the following which works in Internet Explorer 4+ and Netscape Navigator 6+:

<iframe width="100%" height="100" src="blank.htm"></iframe>

<script language="JavaScript"><!--
document.frames[0].document.open();
document.frames[0].document.write('Hello world');
document.frames[0].document.close();
//--></script>

The following was submitted by Stefano B.

This works only on onload() method or onclick() method:

<!--Writing html//-->
idContent.document.body.innerHTML="<b>test</b>";
<!--Writing text//-->
idContent.document.body.innerText="<b>test</b>";

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop