PDA

View Full Version : PNG IE Fix and Image Maps Problem! Urgent!



luminatingsky
Sep 10th, 2007, 11:52 AM
Hi,

Okay i'm in desperate need of some fast help.

My website's slices are saved as .png because i wanted a gradient background and didn't want any issues with it meeting up with my slices etc.

So i saved them as transparent images. No problem.:thumbsup:

I added my image maps. Still good.:thumbsup:

I add a Javascript png fix code for the stupid annoying IE so that it will display my slices correctly and then there is an issue.:mad:

My image maps arn't working. When I hover over the area that is meant to be linked it doesn't register as a link.

It's got to be the Javascript right?

So could someone look at it and tell me what i could change in it so it want do that?

Or if someone knows of another *simple* to use png fix code that won't mess up my image maps?

Here is the JS code -


<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (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=\"" + "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);
</script>



Thanks in advance!

LD