JavaScript Reference/Javascript Properties/parent — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"parent" Example

<!-- 
Example revised from 
The Web Programmer"s Desk Reference
by Lazaro Issi Cohen and Joseph Issi Cohen 
ISBN: 1593270119
Publisher: No Starch Press 2004
-->    
<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>



"parent" is applied to

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



"parent" Syntax and Note

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