framesframes*
*



Contents  *



Index  *Topic Contents
*Previous Topic: forms
*Next Topic: images

frames

Description

Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.

Syntax

object.frames(index)

ParameterDescription
object Either the document or window object.
(index) Optional. An integer or a string specifying the index value of the window to retrieve. Integer indexes are zero-based, meaning the first window in the collection has index 0. A string index is valid only if the string is the name of one window in the document.

Remarks

If the HTML source document contains a BODY tag, the collection contains one window for each IFRAME element in the document. If the source document contains FRAMESET tags, the collection contains one window for each FRAME tag in the document. In both cases, the order is determined by the HTML source.

This collection contains window objects only and does not provide access to the corresponding FRAME and IFRAME elements. To access these elements, use the all collection for the document containing the elements.

Although you can use names with the item method on this collection, the method never returns a collection. Instead, it always returns the first window having the given name. To ensure that all windows are accessible, you should always make sure that no two windows in a document have the same name.

Examples

The following JScript example displays the URLs of the HTML documents contained in windows created by the IFRAME elements in the document.

var frm = document.frames;
for (i=0; i<frm.length; i++)
    alert(frm(i).location);

The following JScript example displays the names of each window defined by FRAME tags in the parent window of the current document.

var frm = window.parent.frames;
for (i=0; i < frm.length; i++) 
    alert(frm(i).name);
}

Property

length

Methods

item

Applies To

document, window


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.