PDA

View Full Version : random background on startup


fumera
01-25-2005, 01:31 PM
looking for a script that loads on startup (onLoad) randomly from a selection a background....

el_beardo
01-27-2005, 02:47 PM
Hi i have have no idea about actionscript but this javascript will do the same thing.

<script language="JavaScript">

function random_image(){
var myimages=new Array()


myimages[1]="./path/Img_0568.jpg"
myimages[2]="./path/Img_0570.jpg"
myimages[3]="./path/Img_0571.jpg"
myimages[4]="./path/Img_0572.JPG"

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<img src="'+myimages[ry]+'" border=0>')
}
random_image()
//-->

</script>

rob

tGP
01-28-2005, 12:55 AM
check out this post.
http://actionscript.org/forums/showthread.php3?t=48368&highlight=random+image+array

cheers
j