Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Frame | Q41 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.