A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/HTMLIFrameElement/contentWindow below:

contentWindow ยท WebPlatform Docs

contentWindow

Property of dom/HTMLIFrameElementdom/HTMLIFrameElement

Syntax
var result = element.contentWindow;
element.contentWindow = value;
Examples

The following example shows how to use the contentWindow property to change the URL of window objects contained inside several iframe objects.

<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>

View live example

Notes Remarks

This property is useful if you do not know the id of the frame or iframe you are accessing through a collection.

Syntax See also Related pages Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4