濮阳杆衣贸易有限公司

主頁 > 知識庫 > iframe框架在IE瀏覽器下將白色背景設(shè)為透明色

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

熱門標(biāo)簽:鄒城智能外呼系統(tǒng) 華為收費(fèi)站地圖標(biāo)注 外呼智能系統(tǒng)報(bào)價 巫山縣地圖標(biāo)注app 騰訊植物園地圖標(biāo)注 浦東新區(qū)百度地圖標(biāo)注圖片 電話機(jī)器人宣傳片 個貸電銷機(jī)器人 經(jīng)綸電銷機(jī)器人
最近在做項(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è)置或獲取對象的背景顏色。

標(biāo)簽:日喀則 廣西 楊凌 唐山 三沙 滁州 那曲 南平

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《iframe框架在IE瀏覽器下將白色背景設(shè)為透明色》,本文關(guān)鍵詞  iframe,框架,在,瀏覽器,下,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《iframe框架在IE瀏覽器下將白色背景設(shè)為透明色》相關(guān)的同類信息!
  • 本頁收集關(guān)于iframe框架在IE瀏覽器下將白色背景設(shè)為透明色的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    广安市| 富源县| 共和县| 全南县| 曲麻莱县| 方正县| 曲沃县| 伊金霍洛旗| 临江市| 六盘水市| 浏阳市| 方正县| 高要市| 博兴县| 盘锦市| 驻马店市| 石屏县| 洪泽县| 大悟县| 宣汉县| 宣威市| 尼木县| 温宿县| 宜川县| 大邑县| 灌阳县| 项城市| 太和县| 法库县| 黄骅市| 依安县| 玛纳斯县| 贡嘎县| 麟游县| 巨野县| 黄骅市| 保康县| 伊金霍洛旗| 万山特区| 阳城县| 宝应县|