View Full Version : Load frame 2 on onLoad frame 1

07-16-2003, 12:58 AM
When page "actual.htm" is started in frame 1 I want to load "new.htm" in frame 2 automatically.

When page "actual.htm" is closed in frame 1 I want to load "old.htm" in frame 2 automatically.

Can anybody tell me the syntax for this actions?

THX a lot.

07-16-2003, 09:32 AM
use <IFRAME> tags for include your pages, give them ID's, than use a simple DHML (in parent page!, called from child with something like parent. function()...) script to window.open() or window.close() or, better, to change the SRC within the IFRAME tags

07-16-2003, 09:39 AM
in actual.htm:

<script type="text/javascript">
window.open("new.htm","name of frame 2");
<body onunload="window.open('old.htm','name of frame 2')">

07-16-2003, 09:50 AM
I might be wrong, but i think so:

<body onunload="window.parent.open('old.htm','name of frame 2')">

I am not very sure that you can comunicate directly fron a child to another. I think you musr refere the parent than to "tell" parent to open/close the other child...

07-16-2003, 09:53 AM
... because 'name of frame 2' is defined in parent body, so that there is no 'name of frame 2' defined in the frame1's body...

07-16-2003, 10:08 AM
the 2nd parameter of window.open() is the window name of the target window, frame or iframe.

if the supplied target name is not existing, the page will be opened in a new window with that specified target as window name, otherwise, it will be opened in the EXISTING window/frame/iframe with that target name.

The four reserved target names are _blank, _parent, _self, and _top which mean new unnamed window, parent window/frame/iframe, current window/frame/iframe and outermost window, respectively.

window.open() is similar with anchor links, <a href="..." target="...">

the only difference is the default target for window.open() is "_blank" and for anchor links is "_self".

hope you understand my explanation.

07-16-2003, 11:59 AM
Hello Kor and Glenn,

thank you for your good help. I could solve my problem with your syntax examples perfectly.
If you want to see the result (the page - although finished - is not yet officially released) you can look at


Look for the owl "Jule" (appears only once on the first page to introduce herself). She appears another time on "Geschäfte/Reisen".