frames property

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



p = object.frames


Property values

Type: IHTMLFramesCollection2

Array of window objects.

Standards information

There are no standards that apply here.


If the HTML source document contains a body tag, the collection contains one window for each iframe object 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 only window objects and does not provide access to the corresponding frame and iframe objects. To access these objects, use the all collection for the document containing the objects.

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, make sure that no two windows in a document have the same name.


This example in JScript (compatible with ECMA 262 language specification) shows how to display the URLs of the HTML documents contained in windows created by the iframe objects in the document.

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

This example in JScript shows how to display the name 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++)