<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" style="background:#E7F5FD;"> </td>
<td style="width:225px; vertical-align:top; background:#E7F5FD;" id="frmleft">
<iframe height="100%" width="100%" border="0" frameborder="0" src="LeftMenu.aspx" scrolling="auto"
allowTransparency=true name="leftFrame" id="leftFrame" title="leftFrame"></iframe></td>
<td style="width:6px; background:url(Public/images/switchbg.gif); vertical-align:middle; white-space:nowrap;" id="splitBar">
<img class="Noprint" src="Public/images/splitBar.gif" id="switchPoint" onClick="switchSysBar()" style="CURSOR:hand" title="关闭/打开左边导航栏">
</td>
<td valign="top"><iframe height="100%" width="100%" border="0" frameborder="0" src="RightMain.aspx" name="rightFrame" id="rightFrame" title="rightFrame"></iframe></td>
<td width="8"> </td>
</tr>
</table>
今天在写一个后台页面
td中设置背景颜色,在火狐下是好的,但是在Ie下显示的是白色,找了原因,是因为
用iframe引用同一个页面,但想让这个页面在不同的引用中有不同的背景色:
一、可以使用iframe的透明来实现:1、给放置iframe的容器设置你要的背景,比如table的单元格
2、把iframe设置为允许透明
3、设置iframe包含的页面背景为透明
这样以来,就可以通过控制单元格的背景色来达到需要的效果了
即在iframe中加上
allowTransparency=true
这个属性
二、在父页面设置iframe的背景即可。
在iframe中的onload调用parent.setFrameBgColor();
然后在每个parent页面都定义一个setFrameBgColor函数如下:
function setFrameBgColor(color)
{
window.iframename.document.body.bgColor=color;
}