Mega Code Archive

 
Categories / JavaScript Tutorial / HTML Tags
 

Reference the top frame

index.html <html>     <head>         <title>Frameset Example</title>     </head>     <frameset cols="100,*">         <frame src="red.htm" name="redFrame" />         <frame src="blue.htm" name="blueFrame" />     </frameset> </html> 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>