<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var images=new Array(new image(), new image(), new image(), new image());
images[0].src="0.gif"
images[1].src="1.gif"
images[2].src="2.gif"
images[3].src="3.gif"
function getRandom(min, max)
{
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rotate(){
d0=getRandom(0,3);
document.i0.src=document.images[d0].src
do {
d1=getRandom(0,3);
document.i1.src=document.images[d1].src
}while (d0==d1)
do {
d2=getRandom(0,3);
document.i2.src=document.images[d2].src
}while ((d0==d2)||(d1==d2))
do {
d3=getRandom(0,3);
document.i3.src=document.images[d3].src
}while ((d0==d3)||(d1==d3)||(d2==d3))
alert(d0+" "+d1+" "+d2+" "+d3);
}
</script>
<p><img name=i0 onclick="rotate()" src="0.gif"><img name=i1 onclick="rotate()" src="1.gif"></p>
<p><img name=i2 onclick="rotate()" src="2.gif"><img name=i3 onclick="rotate()" src="3.gif"></p>
<input type="button" value="rotate" onClick="rotate()">
</HEAD>
</HTML> |