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

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

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

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.

©2018 Martin Webb