HOla que tal, he probado el codigo que puso caricatos esta excelente y asi es lo que quiero hacer, pero pues quiero poner mas imagenes y no se como!!!!!
he intentado poner dos fotos mas pero no me aparecen que debo hacer???
gracias de antemano
aki dejo el codigo:
Código:
<script>
var imagenes = [
"images/ako.gif",
"images/via.gif",
"images/vivdi.jpg",
"images/ara.jpg",
"images/infvit.gif",
"images/apoo.gif",
"images/ingrs_ad.gif"
];
var enlaces = [
"http://www.espaciopropio.com",
"http://www.google.com",
"http://www.expoquierocasa.com",
"http://www.proinfa.com.mx",
"http://www.xxx.com",
"http://www.sxx.com",
"http://www.susdwtura.com"
];
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("href", 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>
y aqui es donde lo pongo en mi tabla :
Código:
<body onload=azar()>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><a href="#" name="enlace1" target="_blank"><img src="" name=imagen1></a></td>
<td><a href="" name=enlace2 target="_blank"><img src="" name=imagen2></a></td>
<td><a href="" name=enlace3 target="_blank"><img src="" name=imagen3></a></td>
</tr>
<tr>
<td><a href="" name=enlace4 target="_blank"><img src="" name=imagen4></a></td>
</tr>
</table>