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');
查看全文
相关阅读:
UVA 10604 Chemical Reaction
UVA 10635 Prince and Princess
UVA 607 Scheduling Lectures
Create Maximo Report
安裝及配置Maximo Report步驟
check blocking
數據據類型縮寫
.net
poj3522
poj1286
原文地址:https://www.cnblogs.com/pyonline/p/1145595.html
最新文章
HDU3363 Count the string KMP 巧用next函数
HDU1358 Period KMP
HDU1686Oulipo KMP
ecshop异常
jQuery 右下角弹窗,托盘
js反混淆
二 关键词关键词的选择(二)
一 搜索指令 在搜索引擎中的使用(1)
filetype 在搜索引擎中的使用方法(2)
asp.net 商城源码
热门文章
将Xml字符串转换成(DataTable || DataSet || XML)对象
二 关键词关键词的研究(一)
jQuery图片切换
UVA 10118 Free Candies
UVA 662 Fast Food
UVA 10558 A Brief Gerrymander
UVA 11151 Longest Palindrome
UVA 10911 Forming Quiz Teams
UVA 10626 Buying Coke
UVA 10564 Paths through the Hourglass
Copyright © 2011-2022 走看看