First, my english is poor, so, I hope you can understand what do i say^^
the problem is,
there has a JavaScript for PNG images to make them transparent in IE6.( In fact, a part of the PNG image is transparent, but IE6 is not supported.)
so, we write a JavaScript, The code is as follow:
---------------------------------------------------
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
}
}
}
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
window.attachEvent("onload", correctPNG);
}
---------------------------------------------------
The code is OK and solve the problem before I install IE9 . If you install IE9, the PNG images does not show in IE6 of IETester, But it's normal in IE6 of Windows xp.
so, it's it.
Test Address: http://v.demo.aobosoft.com/
The LOGO of this site
---------------------------------------------------
IEtester version: 0.4.8
IE 9 version: 9.0.8112.16421
windows 7 professional
Last edited by vr4u (2011-04-09 16:22:23)