I’am trying to get the dice to show as number such as 1,2,3,4,5,6 in the top five boxes instead of dice and save them into a array so that i can evalated the array of dice later. what am i doing wrong.
This is what i’am trying to do
imageshack.us/photo/my-images/202/capturendp.png/
[code]
<html>
<head></head>
<body>
<script>
function roll()
{
var i;
var j;
for (j=1; j<6;j++) {
i = Math.floor(Math.random()*6) + 1; //1-6
document.getElementById(“d”+j).innerHTML = “<img src =’dice”+ i +”.gif’/>”;
<img src=”dice1.gif” name=”1″>
<img src=”dice2.gif” name=”2″>
<img src=”dice3.gif” name=”3″>
<img src=”dice4.gif” name=”4″>
<img src=”dice5.gif” name=”5″>
<img src=”dice6.gif” name=”6″>
var faces = new Array(
“dice1.gif”,
“dice2.gif”,
“dice3.gif”,
“dice4.gif”,
“dice5.gif”,
“dice6.gif”,
);
}
}
</script>
<b><CENTER>
<FONT SIZE=7> Yahtzee</FONT>
</b></CENTER>
<table border=”1″ align=”center”>
<tr>
<td id=”d1″> <img src=”dice0.gif”/> </td>
<td id=”d2″> <img src=”dice0.gif”/> </td>
<td id=”d3″> <img src=”dice0.gif”/> </td>
<td id=”d4″> <img src=”dice0.gif”/> </td>
<td id=”d5″> <img src=”dice0.gif”/> </td>
</tr>
<table border=”1″ align=”center”>
<tr> <td> 1’s </td> <td> <input id=”box1″ type=”text”/> </td>
</tr><tr> <td> 2’s </td> <td> <input id=”box2″ type=”text”/> </td><td></td>
<tr><td> 3’s </td> <td> <input id=”box3″ type=”text”/> </td>
<tr><td> 4’s </td> <td> <input id=”box4″ type=”text”/> </td>
<td><input type=”button” value=”Roll” onClick=”roll()”/></td>
<tr><td> 5’s </td> <td> <input id=”box5″ type=”text”/> </td>
<tr><td> 6’s </td> <td> <input id=”box6″ type=”text”/> </td>
<tr><td> 3 of a kind </td> <td> <input id=”box7″ type=”text”/> </td>
<tr><td> 4 of a kind </td> <td> <input id=”box8″ type=”text”/> </td>
<tr><td> Full house </td> <td> <input id=”box9″ type=”text”/> </td>
<tr><td> Sm straight </td> <td> <input id=”box10″ type=”text”/> </td>
<tr><td> Lg straight </td> <td> <input id=”box11″ type=”text”/> </td>
<td><input type=”button” value=”New game”/> </td></tr>
<tr><td> Yahtzee </td> <td> <input id=”box12″ type=”text”/> </td>
<tr><td> Chance </td> <td> <input id=”box13″ type=”text”/> </td>
<tr><td> Total </td> <td> <input id=”box14″ type=”text”/> </td>
</table>
<body>
<html>