Ok I'm javascript newbie and I have to make script for displaying random images after click on dice picture. The problem is that the script shows only only 1 picture after the clcik and it won't continue with the next random images.
<html>
<head>
<script type="text/javascript">
function randomize(){
var delay = 1500;
var imgs = new Array( );
imgs[0] = "0.jpg";
imgs[1] = "00.jpg";
imgs[2] = "01.jpg";
imgs[3] = "02.jpg";
imgs[4] = "03.jpg";
imgs[5] = "04.jpg";
var preload = new Array();
for(n=0; n<imgs.length; n++)
{ preload[n]=new Image();
preload[n].src=imgs[n];
}
var randomg = Math.round( Math.random( ) * 6 );
if(randomg>=0 && randomg<6){
document.write( "<img alt=\"\" src=\"" +
imgs[randomg] + "\">" );
alert(randomg);}
else{
document.write( "<img alt=\"\" src=\"" +
imgs[1] + "\">" );}
setInterval("randomize()",delay)
}
</script>
</head>
<body>
<img src="dice.jpg" width="200" height="200" onclick="randomize()">
</body>
</html>