IE6的png24支持

简介:
<!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> 
InBlock.gif<html xmlns="http://www.w3.org/1999/xhtml"> 
InBlock.gif<head> 
InBlock.gif <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
InBlock.gif <title>IE 6PNG </title> 
InBlock.gif <style type="text/css"
InBlock.gif img, div { behavior: url(iepngfix.htc) } 
InBlock.gif    
InBlock.gif body 
InBlock.gif { 
InBlock.gif background-color:#800; 
InBlock.gif } 
InBlock.gif </style> 
InBlock.gif</head> 
InBlock.gif 
InBlock.gif<body> 
InBlock.gif <img name="testImg" src="light.png" /> 
InBlock.gif <div id="d" style="padding:50px;font-size:30px;color:#c90;background: url(light.png)"
InBlock.gif    <p>修正png显示</p> 
InBlock.gif </div> 
InBlock.gif 
InBlock.gif</div> 
InBlock.gif 
InBlock.gif</body> 
InBlock.gif</html>
 
iepngfix.htc:
 
< public:component> 
< public:attach event= "onpropertychange" onevent= "doFix()" /> 

<script type= "text/javascript"

// IE5.5+ PNG Alpha Fix v1.0RC4 
// (c) 2004-2005 Angus Turnbull [url]http://www.twinhelix.com[/url] 

// This is licensed under the CC-GNU LGPL, version 2.1 or later. 
// For details, see: [url]http://creativecommons.org/licenses/LGPL/2.1/[/url] 


// This must be a path to a blank image. That's all the configuration you need. 
if ( typeof blankImg == 'undefined')  var blankImg = 'blank.gif'; 


var f = 'DXImageTransform.Microsoft.AlphaImageLoader'; 

function filt(s, m) 

if (filters[f]) 

    filters[f].enabled = s ?  true :  false
     if (s)  with (filters[f]) { src = s; sizingMethod = m } 

else  if (s) style.filter = 'progid:'+f+'(src= "'+s+'",sizingMethod= "'+m+'")'; 


function doFix() 

// Assume IE7 is OK. 
if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) || 
    (event && !/(background|src)/.test(event.propertyName)))  return

var bgImg = currentStyle.backgroundImage || style.backgroundImage; 

if (tagName == 'IMG') 

     if ((/\.png$/i).test(src)) 
    { 
      if (currentStyle.width == 'auto' && currentStyle.height == 'auto') 
        style.width = offsetWidth + 'px'; 
     filt(src, 'scale'); 
     src = blankImg; 
    } 
     else  if (src.indexOf(blankImg) < 0) filt(); 

else  if (bgImg && bgImg != 'none') 

     if (bgImg.match(/^url[( "']+(.*\.png)[)"']+$/i)) 
    { 
      var s = RegExp.$1; 
      if (currentStyle.width == 'auto' && currentStyle.height == 'auto') 
        style.width = offsetWidth + 'px'; 
     style.backgroundImage = 'none'; 
     filt(s, 'crop'); 
      // IE link fix. 
      for ( var n = 0; n < childNodes.length; n++) 
         if (childNodes[n].style) childNodes[n].style.position = 'relative'; 
    } 
     else filt(); 



doFix(); 

</script> 
</ public:component>
 
截图
 




本文转自 xcf007 51CTO博客,原文链接:http://blog.51cto.com/xcf007/107988,如需转载请自行联系原作者



相关文章
|
2月前
|
Web App开发 XML 存储
一篇文章讲明白JPG、PNG、GIF、SVG等格式图片区别
一篇文章讲明白JPG、PNG、GIF、SVG等格式图片区别
|
9月前
jpg、png、gif 的区别是什么?如何进行选择?
jpg、png、gif 的区别是什么?如何进行选择?
36 0
|
9月前
jpg、png、gif 的区别是什么?如何进行选择
jpg、png、gif 的区别是什么?如何进行选择
41 0
|
存储 Web App开发 编解码
图片:前端展示图像(img 、picture、svg、canvas )及常用图片格式(PNG、JPG、JPEG、WebP、GIF、SVG、AVIF等)
图片:前端展示图像(img 、picture、svg、canvas )及常用图片格式(PNG、JPG、JPEG、WebP、GIF、SVG、AVIF等)
736 1
|
3月前
|
Python
image.save()方式支持的图片格式
python保存图片格式
143 0
|
9月前
webp批量转换为png、jpg工具
webp批量转换为png、jpg工具
|
Web App开发 存储 iOS开发
一日一技:把webp图片保存为png
一日一技:把webp图片保存为png
188 0
|
存储 算法 Android开发
聊一聊几种常用web图片格式:gif、jpg、png、webp
在大多数的web页面中,图片占到了页面大小的60%-70%。因此在web开发中,不同的场景使用合适的图片格式对web页面的性能和体验是很重要的。图片格式种类非常多,本文仅针对几种web应用中常用的图片格式:gif、png、jpg、webp进行一个基本的总结。
|
存储 算法 图形学
关于图片的PNG与JPG、JIF格式
关于图片的PNG与JPG、JIF格式
1238 0