Reference the parent frame : frameset : HTML Tags JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » HTML Tags » frameset »

 

Reference the parent frame

















index.htm








<head>
        <title>Frameset Example</title>
    </head>
    <frameset rows="100,*">
        <frame src="frame.htm" name="topFrame" />
        <frameset cols="50%,50%">
            <frame src="anotherframe.htm" name="leftFrame" />
            <frame src="anotherframeset.htm" name="rightFrame" />
        </frameset>
    </frameset>



frame.htm








<head>
<title>topFrame</title>
</head>
<body>
    <h1>topFrame</h1>
    <table border="1">
        <tr>
            <td>window.name =</td><td><script>document.write(window.name)</script></td>
        </tr>
        <tr>
            <td>top.name =</td><td><script>document.write(top.name)</script></td>
        </tr>
        <tr>
            <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
        </tr>
    </table>
</body>



anotherframe.htm








<head>
<title>leftFrame</title>
</head>
<body>
    <h1>leftFrame</h1>
    <table border="1">
        <tr>
            <td>window.name =</td><td><script>document.write(window.name)</script></td>
        </tr>
        <tr>
            <td>top.name =</td><td><script>document.write(top.name)</script></td>
        </tr>
        <tr>
            <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
        </tr>
    </table>
</body>



anotherframeset.htm








<head>
        <title>Frameset Example</title>
    </head>
    <frameset cols="100,*">
        <frame src="red.htm" name="redFrame" />
        <frame src="blue.htm" name="blueFrame" />
    </frameset>



red.htm








<head>
<title>redFrame</title>
</head>
<body>
    <h1>redFrame</h1>
    <table border="1">
        <tr>
            <td>window.name =</td><td><script>document.write(window.name)</script></td>
        </tr>
        <tr>
            <td>top.name =</td><td><script>document.write(top.name)</script></td>
        </tr>
        <tr>
            <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
        </tr>
    </table>
</body>



blue.htm








<head>
<title>blueFrame</title>
</head>
<body>
    <h1>blueFrame</h1>
    <table border="1">
        <tr>
            <td>window.name =</td><td><script>document.write(window.name)</script></td>
        </tr>
        <tr>
            <td>top.name =</td><td><script>document.write(top.name)</script></td>
        </tr>
        <tr>
            <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
        </tr>
    </table>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo HTML Tags
» frameset