JavaScript Reference/Javascript Properties/parent

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

"parent" Example

   <source lang="javascript">


<html> <frameset rows="100,*" frameborder="yes" border="20px" framespacing="5" cols="*">

  <frame name="topFrame" scrolling="NO" noresize src="http://www.wbex.ru">
  <frameset cols="41%,*" border="15px" framespacing="0" rows="*"> 
      <frame name="topFrame" src="myInnerFrame.htm">
      <frame name="mainFrame" src="http://www.wbex.ru">
  </frameset>

</frameset> </html>


Contents of myInnerFrame.htm: <html> <head> <script language="JavaScript"> function function1() {

   alert(window.parent.mainFrame.document.all.CBP.innerText);

} </script> </head> <body style="background-color:white;"> <input type="button" value="View Content of CBP" onclick="function1();"> </body> </html>


     </source>
   
  


"parent" is applied to

   <source lang="javascript">

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

     </source>
   
  


"parent" Syntax and Note

   <source lang="javascript">

Note: Read-only property. In a multiframe environment, returns a reference to the parent window of the current active window.

Syntax:

window.parent


     </source>