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:
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[ ... ]
Be careful not to confuse this with the document.frames property supported by MSIE. That is intended just to list the inline frames within a document.
In Netscape Navigator the window.frames property points back at the window object and the frame objects and frames.length property are stored there as global variables. This is arguably a bug although not all commentators agree. The MSIE implementation is much neater however in that environment, all elements having an ID HTML tag attribute are reflected as member properties of the window. This is not correct either since they should be members of the document and not the window.
Strangely enough, it all seems to work from the scripting point of view. You can access the length value to count the frames and the individual frame objects are available associatively by name from the window.frames property.