设为首页
加为收藏
联系我们
  • 电子商务
  • 软件网络
  • 看天下
  • 营销财经
  • 关闭导航
  • 网络编程
  • 数据库类
  • 关闭导航
  • 网络编程
  • 社交礼仪
  • 数据库类
  • 人文地理
  • 关闭导航
  • 编程工具
  • 电子书籍
  • 关闭导航
  • 生活休闲
  • 演讲讲座
  • 视频教程
  • 经典影视
  • 关闭导航
  • 您的位置: 首页 > 文章中心 > 网络编程 > PHP

    实现PNG在浏览器上透明显示

    时间: 2008-09-25  信息来源: 博客园  作者: 编辑整理  点击数:

    内容提示:好像暂时只支持IE.

    window.onload = function ()
    {

    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=/”" + “width:” + 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;
    }
    }
    }

    好像是only for IE

     
    Tags: PNG,透明 责任编辑:aboutstudy
     
      关于我们 友情链接 网站地图 广告服务 联系我们 管理登陆  
      鄂ICP备07014143号  
      Powered by EmpireCMS 5.0  
      Template designed by 直来直往.
      联系信息: QQ 365931563 Email:jiangtian001@sina.com  
      ©CopyRight 2007-2008, SKDE.CN, Inc. All Rights Reserved