PDA

View Full Version : Nested frames


Quixote
05-11-2004, 02:30 AM
Hi! :)
I open one page (default.htm) with 2 frames, the lower one, called MainFrame, displays actual time (ASP, now), and has one button that opens one windows with another 2 frames. :D
Again, the lower one, called fr_lw, has another button. With it, I want to refresh the MainFrame, or the whole page (default.htm). :thumbsup:
I know how to make reference from one frame to another, or to parent frame, but not to parent.parent frames.
Any help? :mad:

PS you can see it working, at: www.todocaborca.com.mx/frames :eek:
Thanks in advance for your help.
:o

glenngv
05-11-2004, 03:27 AM
To refresh the topmost window (default.htm):

<input type="button" value="Refresh" onclick="top.location.reload()" />


To refresh MainFrame:

<input type="button" value="Refresh" onclick="top.frames['MainFrame'].location.reload()" />

Quixote
05-11-2004, 08:20 AM
Thanks for the code, but it doesn't seem to work.
You can check at www.todocaborca.com.mx/frames and you'll see that it doesn't work.
I put 2 buttons: one for refreshing the default.page, that works without error, but doesn't refresh them, and the other one that should refresh the MainFrame. If you click it, you'll get this message: top.frames.MainFrame.location is nul or not an object.
I tried also with parent instead of top, but also doesn't work. I don't know a lot of JS, so I decided to ask for help.
Any other suggestion? As I told you before, you can check the small page with the problem.
Thanks and I hope you or somebody else can help me! :thumbsup:

glenngv
05-11-2004, 08:53 AM
I visited your link only now and I found out that the page with another frame is in a new window.

Try this now:

To refresh the topmost window (default.htm):

<input type="button" value="Refresh" onclick="if (top.opener && !top.opener.closed) top.opener.top.location.reload()" />


To refresh MainFrame which is the opener of the popup itself:

<input type="button" value="Refresh" onclick="if (top.opener && !top.opener.closed) top.opener.location.reload()" />

Quixote
05-11-2004, 05:21 PM
Just thanks for your help. Now it works fine :p :) :thumbsup: