PDA

View Full Version : Pop up calling frame functions


ryubr
05-10-2003, 12:13 AM
Hi,

I have a page with 3 frames, 3 vertical frames, topF, middleF and bottonF.

The middleF frame have links that opens pop up windows. topF frame have a function inside of it that i want to call via the pop up window or the middleF frame, but unfortunatelly im getting error when i try to use window.topF.document.myfunction().

Why? How can it work for the pop up and frames to call a function into another frame?

Thanks!
Ryu

cheesebagpipe
05-10-2003, 12:37 AM
From the pop-up window:

if (opener && !opener.closed) opener.top.topF.myfunction()

From 'middleF':

top.topF.myfunction()

Remember: a function runs in the window where it is defined, not where you call it from.

ryubr
05-10-2003, 01:37 AM
Thank you very much for the help!!!

If its not an abuse.... a question:

On my topF frame i want to get the location href of the middleF frame, it works one time only, if the page f the middleF frame changes the script cant get it anymore and return error :(

function checkURL()
{
theURL = top.middleF.location
alert(theURL)
setTimeout("checkURL;", 1500);
}

why this? Why after the middleF have a new page the function can't get the location anymore? The idea is to get the url and set it to a variable that i will compare everytime that the function executes, if the "current" url is equel to the last one i increase a var, if that var be bigger than a value i will redirect the user (like a session control), but if the url is different i will set that var =0 and set the new value of the var with the last url.

The idea is to have this to check the middleF frame location and if the user is "stoped" and not navigating.

Why the problem of after the middleF location change the function cant get it anymore? The frames remain there, nothing change, could you help me?

Thanks in advance!
Ryu



Originally posted by cheesebagpipe
From the pop-up window:

if (opener && !opener.closed) opener.top.topF.myfunction()

From 'middleF':

top.topF.myfunction()

Remember: a function runs in the window where it is defined, not where you call it from.