Window.frames[] (Collection)

An array containing window objects, each one referring to the content of a frame within the window.

Availability:

JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Frames object
JavaScript syntax:-frames
-myWindow.frames
HTML syntax:<FRAME> <IFRAME>

The frames property yields an array containing objects, each one of which refers to a separate frame. You can count how many there are with the window.frames.length property. In MSIE, this also includes any inline floating frames created with an <IFRAME> tag.

You can cross-reference between frames in a window by means of the frames property. Every window refers to a frames array, which contains a list of frames within that window. Each frame contains a different window. This can get confusing, but it simply means that frames correspond to windows at the basic object level.

You can also use the opener, parent and top properties as well when you are cross-referencing between windows and frames.

Frames arrays may be nested where windows contain frames within frames. The frames array is like all others, its first element is at index 0. This means that something as confusing as this is legal:

frames[0].frames[2].frames[1]

As a window reference, that looks in the current window for the first frame, then into the third frame within that and then the second frame within that.

You can use the parent window reference to access windows that are all at the same hierarchical level as the current one. This would be accomplished like this:

parent.frames[ ... ]

Warnings:

See also:<MAP TARGET="...">, Document object, Document.frames[], Frame object, Frames object, Window object, Window.opener, Window.parent, Window.top

Property attributes:

ReadOnly.

insert figure 0060

Cross-references:

Wrox Instant JavaScript - page - 80