Ver Mensaje Individual
  #14 (permalink)  
Antiguo 24/04/2007, 08:32
josecarbono
 
Fecha de Ingreso: noviembre-2003
Ubicación: Frente a la PC
Mensajes: 120
Antigüedad: 20 años, 4 meses
Puntos: 0
Re: Problemas con fotos en formato Png.

Ok, te colocare lo q explican en esa pagina acerca de las imagenes cambiantes. Yo no lo he probado, pruebalo y nos cuentas como te va. Ten muy en cuenta todos los comentarios y la forma en q se debe hacer todo...

Antes q todo ya no utilizaras el pngfix como include, ahora el codigo ira todo directamente en el head y sera este:

<HEAD>

Código:
<!--INICIO DEL CORRECTOR PNG-->



<!--[if lt IE 7]>

<script type="text/javascript">

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 and 6.
{
   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 
		     var imgAttribs = img.attributes;
		     for (var j=0; j<imgAttribs.length; j++)
			 {
			    var imgAttrib = imgAttribs[j];
			    if (imgAttrib.nodeName == "align")
			    {		  
			       if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
			       if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
			       break
			    }
             }
		     var strNewHTML = "<span " + imgID + imgClass + imgTitle
		     strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + 

imgStyle + ";"
	         strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		     strNewHTML += "(src='" + img.src + "', sizingMethod='scale');\""
		     strNewHTML += " onmouseover=\"PNGswap('" + img.id + "');\" onmouseout=\"PNGswap('" + img.id 

+"');\""
		     strNewHTML += "></span>" 
		     img.outerHTML = strNewHTML
		     i = i-1
	      }
       }
   }
}
window.attachEvent("onload", correctPNG);

function PNGswap(myID)
{
   var strOver  = "_on"
   var strOff = "_off"
   var oSpan = document.getElementById(myID)
   var currentAlphaImg = oSpan.filters(0).src
   if (currentAlphaImg.indexOf(strOver) != -1)
      oSpan.filters(0).src = currentAlphaImg.replace(strOver,strOff)
   else
      oSpan.filters(0).src = currentAlphaImg.replace(strOff,strOver)
}

</script>
<![endif]-->






<!--FIN DEL CORRECTOR PNG-->


Código:
<!--INICIO DE LA FUNCION DE CAMBIO DE IMAGEN-->


<script language="JavaScript" type="text/javascript">
<!--
function imgSwap(oImg)
{
   var strOver  = "_on"    // IMAGEN USADA CUANDO EL RATON ESTA ENCIMA
   var strOff = "_off"     // IMAGEN NORMAL
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}
//-->
</script>


<!--FIN DE LA FUNCION DE CAMBIO DE IMAGEN-->
</HEAD>


Ahora donde sea q vaya la imagen tendra estas caracteristicas:

Código:
<img id="img100" src="logo_off.png" width="100" height="100" alt="a PNG logo"
	onmouseover="imgSwap(this)" onmouseout="imgSwap(this)"/>

<img id="img200" src="logo2_off.png" width="100" height="100" alt="another PNG logo"
	onmouseover="imgSwap(this)" onmouseout="imgSwap(this)"/>

<img id="img(N)00" src="logo(N)_off.png" width="100" height="100" alt="another PNG logo"
	onmouseover="imgSwap(this)" onmouseout="imgSwap(this)"/>
El nombre logo no es necesario, podria ser cualquier nombre, lo q si es necesario según dicen ahi es q termine en "_off" para la primera y "_on" para la q cambia.

Bueno, espero te funcione, mas tarde q me desocupe un poco lo reviso y lo pruebo a ver como me fue... Suerte y cualquier cosa nos cuentas..

Un abrazo...


Página original: http://homepage.ntlworld.com/bobosola/png_mouseover.htm
__________________
Sin sombra no hay luz...