JavaScript » Window » frames

Syntax:
window.frames("frameID")

This property is an array containing references to all the named child frames in the current window.

This property is an array containing references to all the named child frames in the current window. These references are stored in the array in the order in which they are defined in the source code. The "frameID" argument is used to access items in the array and this can either be a string containing the child frame name as defined with the tag in the HTML source, or an integer (with '0' being the first item in the array).

Examples

Code:
window.frames["framename1"]
window.frames["framename2"]
window.frames["framename3"]

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

window.frames.length
Explanation:

The first two examples below return the same results; the first uses the defined names of the frames and the second uses their reference number within the array.

The frames array also has a length property which determines how many child frames are contained within a window. This is identical to using the length property of the window object. The third example shows the syntax for this.