• png透明图片,ie下的怪异模式,无法显示的解决方法


    方法一:

    .mypng是png透明图片的class

    /* ie6 png */

    .mypng img {

    azimuth:expression(this.pngSet?this.pngSet=true:(

    this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?

    (this.runtimeStyle.backgroundImage = "none", 

    this.runtimeStyle.filter = "progid:DXImageTransform.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 = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + 

    this.origBg + "', sizingMethod='crop')", this.runtimeStyle.backgroundImage = "none")), 

    this.pngSet=true);

    }

     

    方法二:
    调用js代码对全站png图片处理
    <!--[if IE 6]> 
    <script>
    function correctPNG() 
    {
    for(var i=0; i<document.images.length; i++)
    {
    var img = document.images[i];
    var imgName = img.src.toUpperCase();
    if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
    {
    var imgID = (img.id) ? "id='" + img.id + "' " : "";
    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
    var imgStyle = "display:inline-block;" + img.style.cssText;
    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
    var strNewHTML = "<span "+ imgID + imgClass + imgTitle + "style="" + "" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src='" + img.src + "', sizingMethod='scale');"></span>";
    img.outerHTML = strNewHTML;
    i = i-1;
    }
    }
    }
    window.attachEvent("onload", correctPNG);
    </script>
    <![endif]--> 

  • 相关阅读:
    【WPF】wpf image控件加载网络图片不显示问题,
    【VS】vs修改大小写快捷键
    【C#】菜单功能,将剪贴板JSON内容或者xml内容直接粘贴为类
    【异常】调用的目标发生了异常
    【MySQL】函数IFNULL、设置默认时间
    【Kindle】pdf转mobi适合kindle查看格式
    【WPF】中的文字修饰——上划线,中划线,基线与下划线
    vscode使用Eslint + prettier + beautify 格式化vue 代码不换行
    Office文件转PDF
    MSSQL同步刷新视图字段长度和源表保持一致
  • 原文地址:https://www.cnblogs.com/ywwloveys/p/3765706.html
Copyright © 2020-2023  润新知