Como cambio imagenes en un mismo espacio?

La idea es mostrar varia imagenes cambiando automaticamente en un mismo cuadro
[email protected]
venezuela

1 respuesta

Respuesta
1
Aca tenes un codigo para lo que necesitas espero te sirva
<script language="javascript">
var delay=3000 //set delay in miliseconds
var curindex=0
var randomimages=new Array()
randomimages[0]="http://www.tudominio.com/banner/ban_tudominio.gif"
randomimages[1]="http://www.tudominio.com/banner/barnertiemblo.gif"
randomimages[2]="http://www.tudominio.com/banner/detodo_plus.gif"
randomimages[3]="http://www.tudominio.com/banner/educaionfamiliar.gif"
randomimages[4]="http://www.tudominio.com/banner/gotita.gif"
randomimages[5]="http://www.tudominio.com/banner/nuestramansion.gif"
var preload=new Array()
for (n=0;n<randomimages.length;n++)
{
preload[n]=new Image()
preload[n].src=randomimages[n]
}
document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
function rotateimage()
{
if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex
document.images.defaultimage.src=randomimages[curindex]
}
setInterval("rotateimage()",delay)
</script>

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas