Foros del Web » Programando para Internet » Javascript »

flash aleatorios sin repetir

Estas en el tema de flash aleatorios sin repetir en el foro de Javascript en Foros del Web. Hola a todos, encontré el siguiente código que jala 4 imagenes jpg o gif (de un total de n imágenes) de forma aleatoria y las ...
  #1 (permalink)  
Antiguo 08/08/2004, 22:15
Avatar de Tarecito  
Fecha de Ingreso: noviembre-2003
Ubicación: Lima - Perú
Mensajes: 443
Antigüedad: 20 años, 5 meses
Puntos: 1
flash aleatorios sin repetir

Hola a todos, encontré el siguiente código que jala 4 imagenes jpg o gif (de un total de n imágenes) de forma aleatoria y las coloca en una tabla de 4 celdas, cada imagen en una celda pero sin que se repita ninguna imagen. Lo que busco es lo mismo pero con animaciones en flash, alguien podría ayudarme a cambiar el código? o si tienen uno mejor se lo agradecería muchísimo. Gracias de antemano.
Aquí les paso el código:

<html>
<head>
<title>
4 imágenes sin repetir
</title>
<script>
var imagenes = [
"f:/Imágenes/DragonBall/028.jpg",
"f:/Imágenes/DragonBall/054.jpg",
"f:/Imágenes/DragonBall/082.jpg",
"f:/Imágenes/DragonBall/boo_02.jpg",
"f:/Imágenes/DragonBall/boo_03.jpg",
"f:/Imágenes/DragonBall/boo_04.jpg",
"f:/Imágenes/DragonBall/boo_05.jpg"
];

var enlaces = [
"e:/DragonBall/028.jpg",
"http://www.sucaricatura.com/2002/mini/2002H002.jpg",
"http://www.sucaricatura.com/2002/maxi/2002H003.jpg",
"http://www.sucaricatura.com/2002/mini/2002H004.jpg",
"http://www.sucaricatura.com/2002/maxi/2002H005.jpg",
"http://www.sucaricatura.com/2002/mini/2002H006.jpg",
"http://www.sucaricatura.com/2002/maxi/2002H007.jpg"
];

function azar() {
var temp = new Array(4);
temp[0] = Math.floor(Math.random() * imagenes.length);
do
temp[1] = Math.floor(Math.random() * imagenes.length);
while (temp[0] == temp[1])
do
temp[2] = Math.floor(Math.random() * imagenes.length);
while (temp[0] == temp[1] || temp[0] == temp[2] || temp[1] == temp[2])
do
temp[3] = Math.floor(Math.random() * imagenes.length);
while ( temp[0] == temp[1] ||
temp[0] == temp[2] ||
temp[1] == temp[2] ||
temp[0] == temp[3] ||
temp[1] == temp[3] ||
temp[2] == temp[3]
)
// alert(document.links.length);
document.getElementById("enlace1").setAttribute("h ref", enlaces[temp[0]]);
document.getElementById("enlace2").href = enlaces[temp[1]];
document.getElementById("enlace3").href = enlaces[temp[2]];
document.getElementById("enlace4").href = enlaces[temp[3]];
document.images.imagen1.src = imagenes[temp[0]];
document.images.imagen2.src = imagenes[temp[1]];
document.images.imagen3.src = imagenes[temp[2]];
document.images.imagen4.src = imagenes[temp[3]];
}
</script>
</head>
<body onload=azar()>
<a href="#" name="enlace1">
&nbsp;
</a>
<a href="" name=enlace2>
</a>
<a href="" name=enlace3>
</a>
<table border="1" width="100%">
<tr>
<td width="25%">
<a href="#" name="enlace1">
<img src="" name=imagen1>
</a>
</td>
<td width="25%">
<a href="" name=enlace2>
<img src="" name=imagen2>
</a>
</td>
<td width="25%">
<a href="" name=enlace3>
<img src="" name=imagen3>
</a>
</td>
<td width="25%">
<a href="" name=enlace4>
<img src="" name=imagen4>
</a>
</td>
</tr>
</table>
</body>
</html>
  #2 (permalink)  
Antiguo 09/08/2004, 18:21
Avatar de Tarecito  
Fecha de Ingreso: noviembre-2003
Ubicación: Lima - Perú
Mensajes: 443
Antigüedad: 20 años, 5 meses
Puntos: 1
vamos muchachos... alguien debe saber, me dijeron que en este foro están los tromes. que podían ayudarme.
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 10:27.