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');
查看全文
相关阅读:
WPF 对显示列顺序的缓存处理
WPF DataGrid Header语言切换处理
ini操作类
C# 校验 正则
TreeView 数据绑定及选中命令处理
Sql server Compact 小型数据库损坏修复
单例模式 与lock用法
C#串口控制
mysql group by 组内排序
mysql general log开启
原文地址:https://www.cnblogs.com/pyonline/p/1145595.html
最新文章
[精华][推荐]SSO CAS单点登录搭建详细步骤及源码
(四)整合spring cloud云服务架构
(三)spring cloud微服务分布式云架构
(二)spring cloud微服务分布式云架构
(一)spring cloud微服务分布式云架构
(十七)springmvc+mybatis+dubbo+zookeeper分布式架构 整合
(十六)springmvc+mybatis+dubbo+zookeeper分布式架构 整合
37 代码中设置backgroundResource之后要手动设置下padding
36 动态的为TextView赋值并获取TextView的宽度
35 属性动画
热门文章
2 android学习资料
34 帧动画
33 原始资源(音乐视频等)
32 Style样式
31 补间动画资源文件
30 ClipDrawable
29 状态选择器
VS2013打包与部署
spinLock用法
Java 开发环境配置
Copyright © 2011-2022 走看看