Understanding the Difference between Parent and Top Frames


The window property parent is a reference to the window that defined the frameset. Use the parent reference when you need to access functions, variables, or elements in another frame. For example:

 parent.frames[0].document.form[0].theTextArea.value = "New Text"; 

If you have several frames that are nested inside each other, you can use the parent of the parent property:

 parent.parent.frames[0]; 

The window property top, on the other hand, always refers to the window object that contains the frame. Scripts contained in frames can access variables and functions loaded in the topmost position of the window by referencing the top attribute.




JavaScript Professional Projects
JavaScript Professional Projects
ISBN: 1592000134
EAN: 2147483647
Year: 2002
Pages: 130
Authors: Paul Hatcher

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net