Working with Iframes

An iframe is an inline frame, that is, a frame that can be embedded within a regular HTML page instead of needing to be inside a frameset. Like a regular frame, an iframe is a separate HTML document. You can use an iframe as the target of a script, so you can create content on the fly under script control and display it in the page without having to use a frameset.

In this task, we have a regular HTML page with a content area that is an iframe. The content of the iframe is created using JavaScript. Script 5.14 creates the regular page. Script 5.15 is the placeholder HTML document that shows the user the initial content in the iframe, namely the “Please load a page” instruction, as shown in Figure 5.13. That content will ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.