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');
查看全文
相关阅读:
字节跳动在 Go 网络库上的实践
TCP报文段的首部格式 20字节的固定首部
网易公开课 文件描述符 索引
网易新闻App架构重构实践:DDD正走向流行
货 | 携程是如何做AB实验分流的
Pusher Channels Protocol | Pusher docs https://pusher.com/docs/channels/library_auth_reference/pusher-websockets-protocol
避免重复提交?分布式服务的幂等性设计! 架构文摘 今天 点击蓝色“架构文摘”关注我哟 加个“星标”,每天上午 09:25,干货推送! 来源:https://www.cnblogs.com/QG-whz/p/10372458.html 作者:melonstreet
前置时间(Lead Time),也称前置期、备货周期
滴滴业务研发的精益实践
DevOps运动的缘起 将DevOps想象为一种编程语言里面的一个接口,而SRE类实现了这个接口
原文地址:https://www.cnblogs.com/pyonline/p/1145595.html
最新文章
is_callable Callbacks / Callables What is a “callable”? 可调用 回调函数
Why failover-based implementations are not enough Redis分布式锁实现 SET resource_name my_random_value NX PX 30000
415 Unsupported Media Type
房产基于Swoole的PHP RPC框架设计
secure hashes message digests 安全哈希 消息摘要
为了更好的多线程性能,在对象创建或者更新时,若数据大于2047字节则 Python 的 GIL 会被释放。 执行计算密集型任务如压缩或哈希时释放 GIL
You shouldn't use *any* general-purpose hash function for user passwords, not BLAKE2, and not MD5, SHA-1, SHA-256, or SHA-3
美团配送A/B评估体系建设与实践
get uuid
终止轮询
热门文章
Salt (cryptography)
@functools.lru_cache()
自定义敏感配置项目
客户端必须在它发送到服务器的所有帧中添加掩码(Mask)
Supporting Multiple Versions of WebSocket Protocol 支持多版本WebSocket协议
all header field names in both HTTP requests and HTTP responses are case-insensitive.
结束握手
It is thread-safe and idempotent, but not reentrant.
Connection Pool
WebSocket TCP HTTP
Copyright © 2011-2022 走看看