最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iframe框架在IE瀏覽器下將白色背景設(shè)為透明色

  發(fā)布時間:2014-06-13 10:27:08   作者:佚名   我要評論
使用iframe畫頁面的層級框架,大部分瀏覽器是沒有背景的,在IE中默認(rèn)是有一個白色的背景色的,為了顯示的更美觀一些將iframe中的allowTransparent屬性設(shè)置為true,即可
最近在做項(xiàng)目的過程中需要頻繁的使用iframe畫頁面的層級框架,大部分瀏覽器是沒有背景的,但是iframe在IE中默認(rèn)是有一個白色的背景色的,當(dāng)主背景色不是白色的時候,在這一部分會顯得很突兀。幫助手冊中給出了解決方案,即將iframe中的allowTransparent屬性設(shè)置為true,即可。在幫助文檔中也給出了相應(yīng)的示例,示例如下:

復(fù)制代碼
代碼如下:

<BODY STYLE="background-color: red">
<IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true">
</IFRAME>
<IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true"
STYLE="background-color: green">
</IFRAME>
<IFRAME ID="Frame3" SRC="transparentBody.htm">
</IFRAME>
<IFRAME ID="Frame4" SRC="transparentBody.htm"
STYLE="background-color: green">
</IFRAME>
</BODY>

理論上,這樣做就沒問題了,但是呢IE好像反應(yīng)不大,依舊還是有白色的背景。其實(shí)到了這一步,我們還需要在子頁面的<body>標(biāo)簽添加<body bgColor="transparent">,示例如下:
http://img.blog.csdn.net/20140610165850968?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQva3VucGVuZ19tdWJhbw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center

main.html主頁面代碼:

復(fù)制代碼
代碼如下:

<html>
<head>
<title></title>
</head>
<body style="background-color:blue;">
<table
style="width:100%;border:0;height:100%;cellpadding:0;cellspacing:0">
<tr height="100%">
<td height="100%" width="30%">
<iframe id="test1" src="test1.html" allowTransparency="true" width="100%" height="100%"></iframe></td>
<td height="100%" width="40%">
<iframe id="test2" src="test2.html" allowTransparency="true" width="100%" height="100%"></iframe></td>
<td height="100%" width="30%">
<iframe id="test3" src="test3.html" width="100%" height="100%"></iframe></td>
</tr>
</table>
</body>
</html>

test1.html頁面代碼:

復(fù)制代碼
代碼如下:

<html>
<head>
<title></title>
</head>
<body bgcolor="transparent">
<h1>test1</h1>
</body>
</html>

test2.html頁面代碼:

復(fù)制代碼
代碼如下:

<html>
<head>
<title></title>
</head>
<body>
<h1>test2</h1>
</body>
</html>

test3.html頁面代碼:

復(fù)制代碼
代碼如下:

<html>
<head>
<title></title>
</head>
<body>
<h1>test3</h1>
</body>
</html>

這個小例子主要是iframe標(biāo)簽的allowTransparency屬性應(yīng)用,在該屬性設(shè)置為true并且iframe所加載的子頁面的<body>標(biāo)簽背景顏色設(shè)置為transparent(透明)時,iframe將透明化。

allowTransparency設(shè)置或獲取對象是否可為透明。
bgColor 設(shè)置或獲取對象的背景顏色。

相關(guān)文章

最新評論

武义县| 扎赉特旗| 普定县| 衡南县| 万宁市| 会宁县| 徐汇区| 盐池县| 右玉县| 久治县| 宜宾市| 永城市| 大邑县| 鄄城县| 大悟县| 滦平县| 正镶白旗| 岐山县| 临桂县| 永顺县| 高清| 安达市| 蕉岭县| 阿克陶县| 龙门县| 清新县| 龙川县| 乾安县| 乐昌市| 广河县| 荃湾区| 简阳市| 交城县| 安乡县| 剑阁县| 卢龙县| 嘉黎县| 扶绥县| 囊谦县| 琼结县| 鹿邑县|