zoukankan      html  css  js  c++  java
  • 插入透明32位png格式图片支持ie5.5+、 FF、chrome、safari

    // 页面引用js
    function correctPNG()
    {
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters))
    {
    for(var j=0; j<document.images.length; j++)
    {
    var img = document.images[j]
    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
    j = j-1
    }
    }
    }
    }
    if (document.all) {
    // IE
    window.attachEvent("onload",correctPNG);
    } else {
    // Firefox
    window.addEventListener('load', correctPNG, false);
    }
  • 相关阅读:
    selenium操作浏览器-窗口切换
    selenium操作浏览器
    selenium+java+chrome环境搭建
    python-s and s.strip()
    java-趣味算法
    基础正则表达式介绍与练习
    python网络爬虫,知识储备,简单爬虫的必知必会,【核心】
    django模型——数据库(二)
    模型——数据库(一)
    django的模板(二)
  • 原文地址:https://www.cnblogs.com/DoNetCShap/p/2287659.html
Copyright © 2011-2022 走看看