www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
HTML and DHTML Overviews and Tutori...
 Using IFRAME Elements
Using IFRAME Elements

In Microsoft Internet Explorer 5.5 and later, frames are windowless, resulting in greatly improved performance. In addition, Internet Explorer 5.5 and later can now overlap IFRAME elements—also known as inline floating frames—and can make the content inside inline floating frames transparent.

Inline floating frames provide the following features:

  • Increased performance over previous versions of Internet Explorer. Internet Explorer 5.5 and later have been optimized to handle inline floating frames more efficiently. This means faster rendering, less memory, and faster scrolling.
  • Inline floating frames can be stacked over other inline floating frames.
  • Inline floating frames can contain transparent content.

The following topics are discussed in this document:

Creating Inline Floating Frames

To create a inline floating frame, use the IFRAME tag.

<iframe name="Frame1" src="frame.htm" >
</iframe>

The IFRAME tag creates a floating frame at its location in the HTML file. Internet Explorer renders the frame inline. The SRC attribute specifies the content to be displayed within the frame.

You can also place content into the previous IFRAME tag by using a frame destination, as follows:

<a href="http://www.microsoft.com" target="Frame1">See Microsoft's Web Site</a>

The previous example creates a hyperlink that navigates to Microsoft's Web site inside the inline floating frame. It uses the TARGET attribute to load the Web page into the IFRAME. The NAME attribute on the IFRAME tag indicates the TARGET for the A tag.

security note Security Alert   To protect user privacy and safeguard your applications, Internet Explorer restricts some interactions between frames that host Web pages from different domains. For more information about using the Dynamic HTML (DHTML) object model with the frame and iframe objects, see About Cross-Frame Scripting and Security and Security Considerations: Dynamic HTML.

Using Transparency with Inline Floating Frames

Although Internet Explorer has supported transparent elements since Internet Explorer 4.0, only Internet Explorer 5.5 and later support transparent content with inline floating frames.

The following conditions must be met to define transparent content for inline floating frames.

Note  The BGCOLOR attribute can be applied to the BODY element, but it is deprecated as of HTML 4.0. It is recommended that you use the background-color attribute instead.

The following example shows how to apply the background-color attribute to the IFRAME content source file.

<html>
    <body style="background-color:transparent">
        <p>Transparent.</p>
    </body>
</html>

The following example shows how the IFRAME element is written for transparent content.

<iframe name="Frame1" src="frame.htm" allowTransparency="true">
</iframe>

Stacking Inline Floating Frames

Internet Explorer 4.0 and later supports the z-index attribute. However, only Internet Explorer 5.5 and later support the z-index attribute with inline floating frames. By specifying the z-order of floating frames, you can stack one frame on top of another.

To specify the position of the inline floating frame, use the z-index attribute.

<iframe src="frame.htm" style="z-index:1" >
</iframe>

Items are stacked from a smaller z-index value to a larger z-index value, and the value can be negative.

This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Related Topics

Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG