asp.net.ph

Skip Navigation Links

frames Collection

DHTML Collections


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

Syntax


[ collFrames = ] object.frames
[ oObject = ] object.frames ( vIndex [ , iSubIndex ] )

Possible Values


collFrames Reference to an array of elements contained by the object.
vIndex Required. Number or string specifying the element or collection to retrieve. If this parameter is a number, the method returns the element in the collection at the given position, where the first element has value 0, the second has 1, and so on. If this parameter is a string and there is more than one element with the nameor id property equal to the string, the method returns a collection of matching elements.
iSubIndex Optional. Position of an element to retrieve. This parameter is used when vIndex is a string. The method uses the string to construct a collection of all elements that have a name or id equal to the string and then retrieves from this collection the element at the position specified by iSubIndex.

Members



Remarks

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 window objects only 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.

Example

The following 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 );

The following example displays 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 ++ )
   alert ( frm ( i ).location );
Applies To

document, window



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note