Foros del Web » Programando para Internet » Javascript »

Problemas con fotos en png

Estas en el tema de Problemas con fotos en png en el foro de Javascript en Foros del Web. Hola Estoy haciendome una web y estoy utilizando fotos en png con transparencia. El problema es que en IE 7 funciona pero en IE 6 ...
  #1 (permalink)  
Antiguo 20/04/2007, 10:40
 
Fecha de Ingreso: mayo-2006
Mensajes: 39
Antigüedad: 18 años
Puntos: 0
Problemas con fotos en png

Hola

Estoy haciendome una web y estoy utilizando fotos en png con transparencia.
El problema es que en IE 7 funciona pero en IE 6 no me conserva la transparencias.
El otro dia me pasaron un script con el cual podia ver fotos png con transparencia, pero este no era compatible con este script que utilizo para cambiar una foto por otra a sobre posicionarme con el raton.

Alguien puede ayudarme.


Actualmente utilizo un script para cambiar de una foto a otra:

<Head>
<SCRIPT LANGUAGE="Javascript">
<!-- - CAMBIO DE FOTO-->
<!-- Swap images
function Permut (flag,img) {
if (document.images) {
if (document.images[img].permloaded) {
if (flag==1) document.images[img].src = document.images[img].perm.src
else document.images[img].src = document.images[img].perm.oldsrc
}
}
}
function preloadPermut (img,adresse) {
if (document.images) {
img.onload = null;
img.perm = new Image ();
img.perm.oldsrc = img.src;
img.perm.src = adresse;
img.permloaded = true;
}
}
// -->
</SCRIPT>

</head>
y en BODY
<a href="servicios.html" onMouseover="Permut(1,'IMG1');" onMouseout="Permut(0,'IMG1');">
<IMG SRC="fotos/maquina.png" width="196" height="195" border=0 NAME="IMG1" onLoad="preloadPermut(this,'fotos/telefono2.gif');" BORDER=0 width="167" height="186" align="left"></A>
  #2 (permalink)  
Antiguo 20/04/2007, 10:47
 
Fecha de Ingreso: mayo-2006
Mensajes: 39
Antigüedad: 18 años
Puntos: 0
Re: Problemas con fotos en png

por cierto este es el script que me enviaron el otro dia y que funciona perfectamente pero no es compatible con el script de cambiar fotos mencionado en el correo anterior.

Un Saludo

<!--[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.AlphaIma geLoader"
+ "(src=\'" + img.src + "\');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:59.