Foros del Web » Programando para Internet » Javascript »

Código para cambiar fotos cada cierto tiempo

Estas en el tema de Código para cambiar fotos cada cierto tiempo en el foro de Javascript en Foros del Web. Hola buenos días. Encontré un código lo he probado en una página en blanco y me funciona, pero en el momento de adaptarlo a la ...
  #1 (permalink)  
Antiguo 10/09/2009, 04:16
 
Fecha de Ingreso: junio-2008
Mensajes: 287
Antigüedad: 15 años, 11 meses
Puntos: 1
Código para cambiar fotos cada cierto tiempo

Hola buenos días.

Encontré un código lo he probado en una página en blanco y me funciona, pero en el momento de adaptarlo a la página que estoy creando no me funciona.

Aqui les dejo el código

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
<
html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<
title>Documento sin t&iacute;tulo</title>

<
link href="dolors.css" rel="stylesheet" type="text/css">
<
style type="text/css">
<!--
.
Estilo2 {color#FFFFFF}
-->
</
style>

<
script language="javascript">
step=0;
function 
autoImgFlip() {
if (
step 4) {step++;}
else {
step=0;}
if (
step==0)
{
a.src="imagenes/foto01.png";}
if (
step==1)
{
a.src="imagenes/foto02.png";}
setTimeout("autoImgFlip()"3000);
if (
step==2)
{
a.src="imagenes/foto03.png";}
if (
step==3)
{
a.src="imagenes/foto04.png";}
}

</script>


</head>


<body class="dolors" onLoad="autoImgFlip();">

<div align="center">
  <table width="950" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
      <td width="700" height="60" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
          <!--DWLayoutTable-->
          <tr>
            <td width="192" height="60" align="left" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="508">&nbsp;</td>
          </tr>
      </table></td>
    <td width="250" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
        <!--DWLayoutTable-->
        <tr>
          <td width="240" height="60" align="right" valign="middle">| Catalan | Catellano | Frances | Ingles | </td>
        <td width="10" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
    </table></td>
    </tr>
    <tr>
      <td height="1" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <!--DWLayoutTable-->
          <tr>
            <td width="950" height="1"></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="30" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666">
          <!--DWLayoutTable-->
          <tr>
            <td width="130" height="30" align="center" valign="middle" class="Estilo2">CONTABILIDAD</td>
          <td width="180" align="center" valign="middle"><span class="Estilo2">GESTI&Oacute;N TRIBUTARIA</span> </td>
          <td width="130" align="center" valign="middle" class="Estilo2">CONSULTOR&Iacute;A</td>
          <td width="200" align="center" valign="middle" class="Estilo2">RECUPERACI&Oacute;N DEL IVA </td>
          <td width="140" align="center" valign="middle" class="Estilo2">NO RESIDENTES </td>
          <td width="30">&nbsp;</td>
          <td width="140" align="center" valign="middle" class="Estilo2">QUIENES SOMOS </td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="1" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <!--DWLayoutTable-->
          <tr>
            <td width="950" height="1"></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="160" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
          <!--DWLayoutTable-->
          <tr>
            <td width="700" height="160">&nbsp;</td>
          </tr>
      </table></td>
      <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666">
          <!--DWLayoutTable-->
          <tr>
            <td width=250 height=160 align="right" valign="top"><img src="imagenes/foto01.png" id="a" width="250" height="160"></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="1"></td>
      <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <!--DWLayoutTable-->
          <tr>
            <td width="250" height="1"></td>
          </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html> 
Se carga la foto01.png pero a partir de hay no me hace nada más, no se cambian las fotos.

Algún experto que me pueda decir donde tengo el fallo?

Muy amables y muchas gracias.
  #2 (permalink)  
Antiguo 10/09/2009, 07:32
Avatar de America|UNK  
Fecha de Ingreso: noviembre-2006
Ubicación: Piura - Perú
Mensajes: 582
Antigüedad: 17 años, 5 meses
Puntos: 56
Respuesta: Código para cambiar fotos cada cierto tiempo

Código javascript:
Ver original
  1. step=1;
  2. function autoImgFlip() {
  3. step++
  4. if(step > 4){ step = 0}
  5. setTimeout("autoImgFlip()", 3000);
  6. document.getElementById("a").src="imagenes/foto0"+step+".png";
  7. }
__________________
/* El que atiende, entiende..., el que entiende, aprende!.
Desarrollo Web Freelance, Contactar */

Última edición por America|UNK; 10/09/2009 a las 07:45 Razón: ...cerrar llave
  #3 (permalink)  
Antiguo 15/09/2009, 02:02
 
Fecha de Ingreso: junio-2008
Mensajes: 287
Antigüedad: 15 años, 11 meses
Puntos: 1
Respuesta: Código para cambiar fotos cada cierto tiempo

Muchas gracias por la respuesta America UNK.

Un saludo
  #4 (permalink)  
Antiguo 08/12/2009, 16:23
 
Fecha de Ingreso: diciembre-2009
Mensajes: 7
Antigüedad: 14 años, 5 meses
Puntos: 0
Respuesta: Código para cambiar fotos cada cierto tiempo

Mi hermano:

Sabes como hacer u rotador de fotos don el visitante haga click para ver las fotos.

Gracias de ante mano por tu respuesta
  #5 (permalink)  
Antiguo 08/12/2009, 18:48
Avatar de zerokilled
Javascripter
 
Fecha de Ingreso: abril-2009
Ubicación: Isla del Encanto, La Borinqueña [+>==]
Mensajes: 8.050
Antigüedad: 15 años
Puntos: 1485
Respuesta: Código para cambiar fotos cada cierto tiempo

@Juancarlos22, http://www.dynamicdrive.com/dynamici...dhtmlslide.htm
__________________
la maldad es una virtud humana,
y la espiritualidad es la lucha del hombre contra su maldad.
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 11:03.