Tuesday, March 06, 2007

Alternative PNG Support for IE6

Hi,
If you are looking for an alternative PNG support for IE6 here is a piece of code.
to use this code you will need the blank.gif
a transparent gif image.

only thing you have to do is,
simply put this function in to your application.
The real matter is calling the function



function pngImages(){
if(document.all){
for(x=0;x < arguments.length;x++){
elm = document.getElementById(arguments[x]);
elm.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='" + elm.src + "')";
elm.src = "images/blank.gif";
}
}
}




function should be called after all image elements loaded, or on the body->onload event.

What you have to do is send function a string which is containing the IDs of png images. like this,

pngImages("logo","faq","blog","about","shadws","bckgrd");

No comments: