window.frames.length

						window.frames["frameName"].length
window.frames[num].length

Description

The length sub property of the frames property of the Window object contains the number of frame instances in a document created with the <frame> tag.

Example

Listing 7.542 uses the length property of frames array and a for loop to access the name of each frame in the window. This information is then written to the document window.

Listing 7.542 Using the length Property
 <script language="JavaScript"> <!-- Hide // Use a for loop to write out the name of each frame. for(var i = 0; i <window.frames.length; i++){ newWin.document.write("The name of frame #" + i); newWin.document.write(" is " + window.frames[i].name + "<br>"); } // End Hide ---> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.