JavaScript Reference/Javascript Collections/frames

Материал из Web эксперт
Перейти к: навигация, поиск

"frames" Example

<html>
<frameset rows="*" cols="125,*" frameborder="yes" border="20px" framespacing="5"> 
   <frame name="leftFrame" scrolling="NO" noresize src="http://www.wbex.ru">
  <frameset rows="200,*" border="15px" framespacing="0"> 
    <frame name="topFrame" noresize scrolling="NO" src="frame2.html">
    <frame name="mainFrame" src="frame3.html">
  </frameset>
</frameset>
</html>

Contents of frame2.html:
<html>
<script language="JavaScript">
var m = window.parent.frames.length;
alert(m);
</script>
<body bgcolor="white">
<h2>Frame 3</h2>
</body></html>



"frames" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |document                        window                        |
+----------------+--------------------------------------------------------------+



"frames" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem()



"frames" Syntax Parameters and Note

Note:
Returns an array of all <frame> elements in the object.
    
Syntax:
    
objectName.frames // returns all frames
objectName.frames(param1, param2) // returns an individual frame

    param1   Required; zero-based index or 
                       the desired member"s id or name attribute.
                       
    param2   Optional; zero-based index for the result returned
                       if param1 matches more than one element.