Ver Mensaje Individual
  #6 (permalink)  
Antiguo 29/02/2012, 03:08
DavoDbdz
 
Fecha de Ingreso: febrero-2012
Mensajes: 4
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: Cambiar imagen cada X segundos

Muchas gracias Naahuel por tu super codigo java...GRACIASSSS!!!!!!!...
yo tambien he conseguido hacer algo...y me funciona...que es lo que mas me sorprende.

Código HTML:
Ver original
  1. function rotar_imagen(){
  2.   var tiempo = 5000;//tiempo en milisegundos
  3.   var arrImagenes = ['xxxxxxx.jpg','xxxxxxx.png', 'xxxxxxx.png'];
  4.   var arrhref = ['http://www.xxxxxxx.com','http://www.xxxxxxx.com', 'http://www.xxxxxxx.com']
  5.  
  6.   _img = document.getElementById('rotativo');
  7.   _a = document.getElementById('rotativos');
  8.  
  9.   //cargar la 1er imagen
  10.   _img.src = arrImagenes[0];
  11.   _a.href = arrhref[0];
  12.   var i=1;
  13.   var y=1;
  14.   setInterval(function(){
  15.     _img.src = arrImagenes[i];
  16.     _a.href = arrhref[y];
  17.     i = (i == arrImagenes.length-1)? 0 : (i+1);
  18.     y = (y == arrhref.length-1)? 0 : (y+1);
  19.   }, tiempo);
  20. }
  21.  
  22. -------------------------
  23.  
  24. <a id="rotativos" target="_blank"><img id="rotativo"  /></a>

Ya os digo...puede que haya algo que no se necesite en el código ya que no tengo mucha idea de JAVA...pero me funciona..JEJEJE.

MUCHAS GRACIAS POR TU COLABORACIÓN NAAHUEL!!!!!