Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/03/2011, 07:40
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 2 meses
Puntos: 192
Respuesta: Javascript para rotar imágenes con hipervínculos

A mi me funciona a la perfección hombre. ¿Te fijaste de hacer los dos cambios que te dije?
Acá lo podés ver funcionando:

http://jsbin.com/ijoki4

Este es código del ejemplo:
Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <meta charset=utf-8 />
  3. <title>JS Bin</title>
  4.  
  5.   article, aside, figure, footer, header, hgroup,
  6.   menu, nav, section { display: block; }
  7.   <script>
  8.     var cont = 0;
  9.   var array_imagenes = [
  10.     ["<a href='http://www.lossimpsons.com'><img border=0 src='http://4.bp.blogspot.com/_2R9QTEVhHfI/TL8ywnPjuGI/AAAAAAAAAuE/whHCzbNOCjo/s1600/888fb70c4jukgrm8a649e07f89e26a6_homer-j-simpson.png' /></a>"],
  11.         ["<a href='http://www.fox.com/familyguy/'><img border=0 src='http://t2.gstatic.com/images?q=tbn:ANd9GcR8uT182YzeWvuKjkbI5iQ3_1YNTfOD5mJMrW7CAMoJnasSK81V&t=1' /></a>"]
  12.     ]
  13.   function cambia()
  14.   {
  15.     var d = document.getElementById("banner_rotativo");
  16.     cont = cont % array_imagenes.length;
  17.     d.innerHTML = array_imagenes[cont][0];
  18.     cont++;
  19.   }
  20.  
  21.   function inicio()
  22.   {
  23.     cambia();
  24.     setInterval(cambia, 5000);
  25.   }
  26.  </script>
  27. </head>
  28. <body onload="inicio();">
  29.   <div id="banner_rotativo"></div>
  30. </body>
  31. </html>

Las imagenes rotan y cada una con un link diferente.