martes, 5 de agosto de 2008

imagen flotante y aleatoria

bagando pro la red me tope con este codigo ^^

es para colocar una imagen flotante y aleatoria (funciona en blogger, no se si en otros)

Aki empiesa el codigo


<script language='JavaScript'>
imagenes = new Array(9)

imagenes[0] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[1] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[2] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[3] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[4] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[5] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[6] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[7] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
imagenes[8] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"

aleatorio = Math.random() * (imagenes.length)
aleatorio = Math.floor(aleatorio)
document.write(imagenes[aleatorio])

</script>



El ke esta con rojo es el numero de imagenes aleatorias.
el azul oviamente donde se coloca la imagen.

para agregar o quitar solo agregas y quitas lineas
imagenes[x] = "<img border='0' src='url-de-la-imagen' style='position:fixed; bottom:0; right:0;'/>"
y modificas el numero de imagenes aleatorias ^^

fuente: gameblog

1 comentario: