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

Q41 Can I write directly to a frame, after defining the frameset?

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

Within the the frameset definition document:

<script language="JavaScript"><!--
document.write('<frameset rows="100,*">');
document.write('<frame src="dummy.html" name=menu>');
document.write('<frame src="main.html" name=main>');
document.write('<\/frameset>');

window.menu.document.open("text/html");
window.menu.document.writeln("Some content I want to write goes here");
window.menu.document.close();
//--></script>

Note for Netscape Navigator 2, dummy.html must be used, must exist, and should perhaps contain:

<body></body>

Note the above will not work in Internet Explorer 3, as the frames might not have been created in time for the document write to work correctly. Instead use this version:

<script language="JavaScript"><!--
function update() {
    window.menu.document.open();
    window.menu.document.writeln("Some content I want to write goes here");
    window.menu.document.close();
}

document.write('<frameset rows="100,*" onLoad="update()">');
document.write('<frame src="dummy.html" name=menu>');
document.write('<frame src="main.html" name=main>');
document.write('<\/frameset>');
//--></script>

©2018 Martin Webb