zoukankan
html css js c++ java
IE6下PNG图片对象以及其作为背景透明的处理
图片对象
function
correctPNG()
{
var
arVersion
=
navigator.appVersion.split(
"
MSIE
"
);
var
version
=
parseFloat(arVersion[
1
]);
if
((version
>=
5.5
)
&&
(version
<
7
)
&&
(document.body.filters))
{
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
}
}
}
}
然后直接onLoad该方法就可以了
如果要将PNG做为背景,并且使得其透明,则可以使用如下样式:
background: url(图片地址) center repeat-y !important;
background:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='图片地址',sizingMethod='scale');
查看全文
相关阅读:
一致性哈希算法 CARP 原理解析, 附 Golang 实现
springSecurity自定义认证配置
jeecms常用的标签
AngularJs分层结构小demo
springSecurity入门小demo--配置文件xml的方式
angularJs实现下拉框多选
angularJs实现动态增加输入框
js判断当前页面是顶级窗口
angularJs的继承
在angularJs实现批量删除
原文地址:https://www.cnblogs.com/pyonline/p/1145595.html
最新文章
Chessboard(规律)&&阿里巴巴和n个大盗(规律)
Pasha and Phone(思维)
Baby Ming and Matrix games(dfs计算表达式)
PowerSploit-CodeExecution(代码执行)脚本渗透实战
Powershell基础之脚本执行
Powershell寻找域管在线服务器
Cymothoa后门工具
WCE-hash注入工具使用
[Quarks PwDump]Hash dump神器
内网转发之reGeorg+proxifier
热门文章
windows服务隐藏后门之克隆帐号
procdump64+mimikatz获取win用户hash密码
Meterpreter后渗透之信息收集
Matplotlib 容器教程
Matplotlib pyplot 教程
MySQL备份与恢复
wxpython笔记:wxpython中的多线程实现
wxPython笔记:窗口添加滚动条
Redigo--Go连接Redis
【经典算法】快速排序算法
Copyright © 2011-2022 走看看