IE6下用DW如何设置透明图片
2010/10/28 11:37:32

  
  使用方法:<div id="test"><img scr="#"/></div> 如果test层有背景,且需要背景透明png,则<div id="test" class="png"><img scr="#"/></div>,如果是图片本身需要透明,则<div id="test"><img scr="#" class="png"/></div>

  举例说明:

  <style type="text/css">

  .mypng img {

  azimuth: expression(

  this.pngSet?this.pngSet=truethis.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",

  this.runtimeStyle.filter = "progidXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",

  this.src = "transparent.gif")this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),

  this.runtimeStyle.filter = "progidXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",

  this.runtimeStyle.backgroundImage = "none")),this.pngSet=true);

  }

  </style>

  <head>标签中调用内容:

  <!--[if lte IE 6]>

  <script src="img/DD_belatedPNG.js"></script>

  <script>

  DD_belatedPNG.fix('#png,.png');

  </script>

  <![endif]-->

  <body>

  在需要的地方调用就可以了。

返回列表
返回首页