在网页中插入一个透明背景的PNG图片

news/2024/7/3 13:36:15 标签: float, filter, function, flash, class, ie
class="baidu_pl">
class="article_content clearfix">
iews" class="htmledit_views">

在网页中插入一个透明背景的PNG图片,可是在显示的时候,它的背景就成灰色了。这是IE的bug。需要加入以下代码:

class="language-html"><script  language="jscript">  
  class="tags" href="/tags/FUNCTION.html" title=function>function    correctPNG()      
        {    
        for(var    i=0;    i<document.images.length;    i++)    
              {    
              var    img    =    document.images    
              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    =    "class="tags" href="/tags/FLOAT.html" title=float>float:left;"    +    imgStyle    
                    if    (img.align    ==    "right")    imgStyle    =    "class="tags" href="/tags/FLOAT.html" title=float>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    +    ";"    
                    +    "class="tags" href="/tags/FILTER.html" title=filter>filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"    
                    +    "(src=\'"    +    img.src    +    "\',    sizingMethod='scale');\"></span>"      
                    img.outerHTML    =    strNewHTML    
                    i    =    i-1    
                    }    
              }    
        }    
  window.attachEvent("onload",    correctPNG); 
  </script>
透明Flash动画设置参数为:参数为wmode         值为transparent



http://www.niftyadmin.cn/n/1732221.html

相关文章

简单易用的前端模拟数据

mock-serve mock-serve 是一个本地的前端模拟数据服务 在前后端分离的架构下&#xff0c;前端开发人员往往需要模拟数据&#xff0c;通常我们经常用的方式有: 在代码里写死通过Mock.js通过Easy-Mock 后两种都是不错的方案&#xff0c;但是根据每个开发人员的环境不同&#xf…

禁止Firefox缓存input的值

在Firefox里面input的值会被缓存起来&#xff0c;刷新页面之后&#xff0c;会恢复成刷新之前的值。有的时候我们并不希望这么做&#xff0c;可以用autocomplete”off”来阻止Firefox的默认机制。 比如下面的代码&#xff0c;在刷新页面之后input的值全部为空。 <form> …

[译] 图解 React Native

原文链接: https://learnreact.design/2017/06/20/what-is-react-native 喜欢理由: 插图大爱 生动有趣 视角独到 特别鸣谢: 原作者 Linton Ye 的倾情校对 系列博客: 用通俗的语言和涂鸦来解释 React 术语 图解 React图解 React Native (本文)组件、Props 和 State深入理解 Pro…

实战:React全家桶仿PC端《快看漫画》(部分)

前言 最近在学习React&#xff0c;为了在学习的同时巩固一下所学内容&#xff0c;决定仿一个《快看漫画》的网页&#xff1b;由于学习进度及时间问题&#xff0c;我只实现了网站的部分功能&#xff1a;登录与退出、对应漫画关注/取关、关键词搜索等。 项目写了一个星期&#xf…

python打开文件并读取2进制,如何在Python中打开和读取二进制文件?

I have a binary file (link) that I would like to open and read contents of with Python. How are such binary files opened and read with Python? Any specific modules to use for such an operation.解决方案The b flag will get python to treat the file as a bina…

前端基础面试题@CSS篇

随笔 最近出去面了一次试。去之前信心满满&#xff0c;去之后灰头土脸&#xff0c;因为连最简单的“css居中方式有多少种”、“说说js数据类型”这种入门问题竟然回答的支支吾吾&#xff0c;也怪不得面试官20分钟就优雅的把我送了出来。 痛定思痛&#xff0c;总结了一些基础面…

fortran无可用源_可照搬实施的商超高可用方案:proxmox + haproxy 等

本文转载自51CTO博客作者sery的原创作品由德纲转发分享如下现状存在大量的单点问题&#xff1a;每个门店一个物理服务器&#xff0c;中心机房多个服务器。门店服务器故障&#xff0c;营业受影响&#xff1b;中心机房服务器故障&#xff0c;门店的非现金业务&#xff08;银行卡刷…

开发了一个 deno 多版本管理工具:dvm

不知不觉中&#xff0c;deno 已经默默的发布了 3 个版本了&#xff1a; 0.1.00.1.10.1.2 昨晚通宵做了一个 deno 多版本的管理工具: dvm。 github 地址: https://github.com/justjavac/dvm 功能基本参考了 nvm。 安装 npm install -g dvm使用 ➜ ~ dvm --helpUsage: dv…