Hello,
I’m creating a program in javascript that randoms number generator to select numbers from 1-6 and displays the results of 30 rolls of a die using images. i have a table of 8 cells wide. Still its giving me problems but here is the code
window.onload = randomDice;
function randomDice() {
var myPix = new Array("images/dice1.jpg","images/dice2.jpg","images/dice3.jpg" ,"images/dice4.jpg" ,"images/dice5.jpg" ,"images/dice6.jpg");
var randomNum = Math.floor(( 1 + Math.random() * 6));
document.getElementById("myPicture").src = document.getElementById("onscreen").src;
document.getElementById("myPicture2").src = myPix[randomNum];
document.getElementById("myPicture3").src = myPix[randomNum];
}
</script>
<table width="500" border="0">
<tr>
<td></td>
<td><img src="images/spacer.gif" id="myPicture" alt="some image"></td>
<td><img src="images/spacer.gif" id="myPicture2" alt="some image"></td>
<td><img src="images/spacer.gif" id="myPicture3" alt="some image"></td>
<td><img src="images/spacer.gif" id="myPicture4" alt="some image"></td>