Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/01/2005, 11:13
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Hola Sette:

Código:
<html>
<head>
<script >
var datos = function(imagen, enlace) {
	this.imagen = imagen;
	this.enlace = enlace;
}
var objetos = new Array();
objetos[0] = new datos("../papanoel.gif", "enlace1.html");
objetos[1] = new datos("../miemoticon.gif", "enlace2.html");
objetos[2] = new datos("../papanoel2.gif", "enlace3.html");
function aleatorio() {
	var azar = Math.floor(Math.random() * objetos.length);
	document.images["imagen"].src = objetos[azar].imagen;
	document.getElementById("enlace").href = objetos[azar].enlace;
}
</script>
</head>

<body onload="aleatorio()">
     <a href="#" name="enlace" id="enlace" onclick="alert(this.href); return false" >
	     <img src="" name="imagen" />
     </a>
</body>
</html>
Lo del evento onclick en el enlace lo puse para hacer pruebas, y el array de objetos no creo que tengas problemas en llenarlos...

Espero que te sirva.

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo