Loading New Documents into Iframes
You can load new documents into the iframe either by specifying a target attribute in the link or through the use of JavaScript. This link specifies the iframe's name in the target attribute and will load Google into the iframe below:
<a href="http://www.google.com" target="ifrm">link</a>
The two rows of links below demonstrate the two methods for loading new documents using JavaScript. Click a Page 2 link in either row for more information.
These links use the frames array to obtain the reference and change its location property.
Links below change the src property of the iframe obtained via document.getElementById.
You can use your browser's menu commands to view source code and save this example document. You can right-click on an iframe to access the source code of the document contained inside it.
Back to Iframes Tutorial