Calling function from another frame. 
Author Message
 Calling function from another frame.

I have html page which is composed from several frames.
For example on first frame I have defined function f1().
I want to call this function from frame 2. Is this
posiible?


Fri, 08 Oct 2004 17:59:50 GMT  
 Calling function from another frame.
Yes - you need to get a reference to the window of the other frame and then
call the function from that.

eg.

// Get a reference to the other window.
var pobjFrameWindow = top.myframename;

// Note that window object is the default here so the full JavaScript
[above]should have been: "top.window.myframename.window".

// Call the function in the other frame.
pobjFrameWindow.myfunction(param1, param2);

Hope this helps.

Chris Barber.


I have html page which is composed from several frames.
For example on first frame I have defined function f1().
I want to call this function from frame 2. Is this
posiible?



Fri, 08 Oct 2004 18:17:09 GMT  
 Calling function from another frame.
Thank's very much! Its working!


Fri, 08 Oct 2004 20:12:22 GMT  
 Calling function from another frame.
I love it when a plan comes together.

NB: When calling scripts in another frame - you should always use:

try{
    // Call your function in the other frame.

Quote:
}

catch(error){
    alert('Script could not be called - an error occurred.')
    // You may wish to use the error.description property to show the error.

Quote:
}

This will stop your de{*filter*} / browser from disappearing up it's own arse in
flames if you get it wrong or the other page / frame is not present.

Chris Barber.


Thank's very much! Its working!



Fri, 08 Oct 2004 22:46:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. calling function in child frame from parent frame

2. Possible to call function from another frame?

3. Calling functions in other frames

4. Call function on other frame?

5. How to call a function across frames

6. calling a function inside some frame

7. Call a function in another frame

8. calling a function in one frame from another

9. calling a JavaScript function from another frame

10. Calling a function in another frame.

11. Call to function in another frame fails after IE5 upgrade

12. Calling functions across frames...

 

 
Powered by phpBB® Forum Software