Iframe还有一个更大的好处,就是可以设置框架透明,让框架内的背景和主页面背景一样。在上例操作中,细心的读者会发现这个问题,下面来详细说明如何设置Iframe透明。具体操作步骤如下:
(1)打开配书光盘中的案例/frame/iframe/see_infomore_iframe1.htm。
(2)在浏览器中浏览该页文件,发现在插入Iframe的区域将原来单元格的背景覆盖了,这不是想要的效果。
(3)打开page.htm页面,切换到代码视图,在<body>标记中插入代码如下:
<body style=”background-color=transparent”>

图10.21 应用Iframe创建翻页
(4)切换see_infomore_iframe1.htm到代码视图,查看页面插入Iframe的单元格的代码如下:
<td height=”30″ colspan=”4″ >
<iframe name=”main” width=”100%” height=”30″ frameborder=”0″ border=0 scrolling=”no” marginwidth=”0″ marginheight=”0″ src=”page.htm”></iframe>
</td>
(5)在<Iframe>标记中,
<frame name=”left” src=”%20index_manager/admin_left.htm%20″ marginwidth=”1″ marginheight=”1″ scrolling=”no” frameborder=”1″ noresize framespacing=”2″ bordercolor=”#cc0000″>
上段代码的各项参数设置及其含义
allowTransparency=”true”
(6)此时插入Iframe的单元格代码如下:
<td height=”30″ colspan=”4″ >
<iframe name=”main” width=”100%” height=”30″ frameborder=”0″ border=0 scrolling=”no” marginwidth=”0″ marginheight=”0″ src=”page.htm” allowTransparency=”true”></iframe></td>
(7)保存page.htm和see_infomore_iframe1.htm两个页面,在浏览器中浏览效果。









