JavaScript Reference/Javascript Properties/contentWindow

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

"contentWindow" Example

    
<html>
<body>
<script language="JavaScript">
    function function1() {
        alert(document.all.myFrame.contentWindow.location);
    }
</script>
<iframe id="myFrame" src="Http://www.wbex.ru" style="width:200;">
</iframe>
<br>
<button onclick="function1();">Location of Frame</button>
</body>
</html>



"contentWindow" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<frame>                         <iframe>                      |
+----------------+--------------------------------------------------------------+



"contentWindow" Syntax and Note

Note:
Read-only property. 
Returns a reference to the window object for a <frame> or <iframe> element.
    
Syntax:
    
document.getElementById("elementID").contentWindow
document.all.elementID.contentWindow // IE only