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

Q904 How can I tell when both frames of a frameset are loaded?

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

Q904 How can I tell when both frames of a frameset are loaded?

You could possibly use the Framesets onLoad event handler:

<html>
<head>
<script language="JavaScript"><!--
loaded = false;
//--></script>
</head>

<frameset cols="50%,*" onLoad="loaded = true">
<frame src="document1.htm">
<frame src="document2.htm">
</frameset>

And then in either document1.htm or document2.htm:

<script language="JavaScript"><!--
function test() {
    if (parent.loaded)
        alert('Loaded');
    else
        alert('Not yet loaded, try again later');
}
//--></script>

<form>
<input type="button" value="Click Me" onClick="test()">
</form>

If however, the contents of one frame is then changed, it doesn't re-trigger the Framesets onLoad event handler.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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