Thread: do you use PNG?
View Single Post
Old 06-12-2005, 03:40 PM  
kernelpanic
Too lazy to set a custom title
 
Join Date: Jan 2005
Posts: 2,961
Quote:
Originally Posted by Chupachups
Will use it when damn IE supports the transparency feature.
IE7 will (their words, trust it as you will)

Besides, there are ways around IE6's retardedness of the PNG standard. You can either use the following function (in javascript), or you can use PNGs whose background is set without the need for transparency. Either way, PNG is often times the best image format for a particular purpose.

Code:
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) hahahaha "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 hahahaha "left") imgStyle = "float:left;" + imgStyle
		 if (img.align hahahaha "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);
kernelpanic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote