CliffLandin
Programmer
I am trying to use a .png as a navigation bar. I am using 'usemap' to create the links and am using JS to lose the grey/blue background created by IE when using transparent PNGs. Here in lies the crux of the problem. The IE/png fix somehow is killing the usemap. It all works fine in any other browser and the PNG fix works great. But now you can't navigate anywhere.
Here is an example of the code:
Thanks in advance for any help that you can give me.
When in doubt, go flat out!
Here is an example of the code:
Code:
<head>
<title></title>
<!--[if gte IE 5.5000]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
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>
<![endif]-->
</head>
<body><div class='mainBody' align='left'><img src="/imgs/nav.png" width="250" height="500" border="0" usemap="#map" />
<map name="map">
<!-- #$-:Image Map file created by GIMP Imagemap Plugin -->
<area shape="rect" coords="20,29,190,68" alt="home" href="[URL unfurl="true"]http://www.mlctunes.com/"[/URL] />
<area shape="rect" coords="20,95,190,135" alt="gallery" href="[URL unfurl="true"]http://www.mlctunes.com/gallery/"[/URL] />
<area shape="rect" coords="20,150,190,187" alt="music" href="[URL unfurl="true"]http://www.mlctunes.com/music/"[/URL] />
<area shape="rect" coords="20,212,190,251" alt="lyrics" href="[URL unfurl="true"]http://www.mlctunes.com/lyrics"[/URL] />
<area shape="rect" coords="20,269,190,308" alt="about" href="[URL unfurl="true"]http://www.mlctunes.com/about"[/URL] />
<area shape="rect" coords="20,329,190,368" alt="contact" href="[URL unfurl="true"]http://www.mlctunes.com/contact"[/URL] />
<area shape="rect" coords="0,426,249,465" alt="MLCtunes" href="[URL unfurl="true"]http://www.mlctunes.com/"[/URL] />
</map>
</div>
Thanks in advance for any help that you can give me.
When in doubt, go flat out!