Mostrar un enlace aleatorio con Javascript

0 - , - 11/01/2007 17:10:08
<script type="text/javascript">
  Nombre = new Array();
  Url = new Array(); 
  Nombre[0] = 'Google';
  Url [0] = 'http://www.google.es';
  Nombre[1] = 'Yahoo';
  Url [1] = 'http://www.yahoo.es';
  Nombre[2] = 'Microsoft';
  Url [2] = 'http://www.microsoft.com';
  Nombre[3] = 'El Pais';
  Url [3] = 'http://www.elpais.es';
  Nombre[4] = 'Adobe';
  Url [4] = 'http://www.adobe.es';
  Nombre[5] = 'Terra';
  Url [6] = 'http://www.terra.es';
  X = Math.round(Math.random()*6);

 document.write('Enlace aleatorio: <a href="' + Url[X] + '" target="_blank">' + Nombre[X] + '</a>')
</script>

Deja tu comentario

  • El comentario debe estar relacionado con el contenido de la entrada.
  • Comentarios ofensivos, con spam o con lenguaje inapropiado serán eliminados.

captcha