contentWindow property
[This documentation is preliminary and is subject to change.]
Retrieves the window object of the specified frame or iframe.
Syntax
| JavaScript | |
|---|
Property values
Type: Object
the window object.
Remarks
This property is useful if you do not know the id of the frame or iframe you are accessing through a collection.
Examples
The following example shows how to use the contentWindow property to change the URL of window objects contained inside several iframe objects.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/contentWindowEX1.htm
<html>
<head>
<SCRIPT>
function fnNavigate()
{
for(i=0;i<document.all.length;i++)
{
if(document.all(i).tagName=="IFRAME")
{
document.all(i).contentWindow.location = "http://www.msn.com";
}
}
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="fnNavigate();">Navigate Frames</BUTTON>
<P/>
<IFRAME SRC="http://www.microsoft.com" STYLE="width:100%;height:150px;">
</IFRAME>
<P/>
<IFRAME SRC="http://www.microsoft.com" STYLE="width:100%;height:150px;">
</IFRAME>
<P/>
<IFRAME SRC="http://www.microsoft.com" STYLE="width:100%;height:150px;"/>
</IFRAME>
</BODY>
</HTML>
See also
Build date: 3/8/2012