2010-11-24 134 views
0

我知道這有些愚蠢的問題,但我無法弄清楚如何在IE6中製作透明的PNG工作。我嘗試了幾件事,但他們沒有奏效。我想知道是否有人能讓我知道一個合適的黑客?IE6問題中的PNG透明度

由於提前,

AD72

+0

說出你嘗試過哪些方法不起作用會很有幫助。 – 2010-11-24 15:02:07

+0

它被任何機會用作CSS背景圖片嗎? – Paddy 2010-11-24 15:04:13

回答

1

你有沒有試過這種方法? link text

我已經嘗試了一些PNG攻擊前IE6,這是最好的一個,解決所有的問題,即與巴可。祝你好運

1

下面是我們使用的代碼,似乎工作正常。

// from http://labs.unitinteractive.com/unitpngfix.php 

var clear="/images/template/clear.gif" //path to clear.gif 

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}} 
window.attachEvent('onload',pngfix); 
0

圖像的PNG格式是Post Notational Graphic,主要在英格蘭維多利亞女王時代的法律中描述,因此主要用於英國。用於創建和顯示PNG圖像的軟件來源於英格蘭並受其保護,所有瀏覽器和不同的新瀏覽器版本和內容環境所需的不同顯示軟件版本可能尚未委託完成,並且不兼容性可能會持續存在時間。最初的協議是MS和IE瀏覽器僅用於顯示PNG,並且可能爲其他瀏覽器開發了許多非官方的黑客和解碼器,並取得了不同的成功。只有在確定的國家和省份名單中使用PNG時,PNG才能正式完全可以呈現。