PNG-billeder som baggruund ?
Hej...Nogle af jer der kan hjælpe mig med at på et PNG-billede som baggrund ?
Mine koder ser sådan ud...:
transpfile="<%=help_url%>img/pix.gif";
if(window.attachEvent)window.attachEvent("onload", function(){dohIE_png(document)}); // PNG er kun et problem i IE
function dohIE_png(tn){
tn=tn.getElementsByTagName("img");
for(i=0;i<tn.length;){
if((tn[i].src.substring(tn[i].src.length-3).toLowerCase()=="png")&&tn[i].offsetWidth!=0&&tn[i].rel!="pngfixed"){
tmp=document.createElement("img");
tmp.style.width=tn[i].offsetWidth+"px";
tmp.style.height=tn[i].offsetHeight+"px";
tmp.style.border="0";
tmp.src=transpfile;
tmp.setAttribute("rel","pngfixed");
if(tn[i].id)tmp.setAttribute("id",tn[i].id);
if(tn[i].alt)tmp.setAttribute("alt",tn[i].alt);
if(tn[i].className)tmp.setAttribute("className",tn[i].className);
if(tn[i].title)tmp.setAttribute("title",tn[i].title);
tmp.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+tn[i].src+"', sizingMehod='scale')";
tn[i].parentNode.replaceChild(tmp,tn[i]);
}else i++
}
}
--------------------------------
<img src="<%=man_URL%>/img/menu.png" border="0" style="visibility:visible;">
--------------------------------
Som gerne skulle se sådan ud...:
<div style="background-image:url(<%=man_URL%>/img/menu.png);"></div>
