要么用js,或htc插件,要么用ie滤镜。。以下提供滤镜解决方案
/* for ie6 */
*html .big_title {
background:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/qiye2.png', sizingMethod='crop');}
ps:滤镜只能用作背景图片,直接用<img>标签引用的话滤镜解决不了
用png.js文件来过滤的代码:
function correctPNG()
{
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=\"" + "width:" + 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
}
}
}
window.attachEvent("onload", correctPNG);
// JavaScript Document
文章来自深蓝互联http://www.szdbi.com/WEBkaifajishu/2015-01-25/49.html转载请注明出处!
上一篇:JS文字无缝循环滚动代码