I'm new to the switch statement and I'm trying to put the case one value in "onmouseover="getValue(1)"" and can't seem to get it to work. Could someone tell me what I'm doing wrong
Also I'll have several cases because this is going to be a yahtzee game.
Code:function getValue(category) { d = new Array(6); for(var i = 0; i < 5; i++) { // parses values from numbered pictures and plases them into another // array for sorting d[i] = 1 * dice[i].src.charAt(dice[i].src.length - 5); } d.sort(); switch(category) { case 1: { // Counts the ones in d[] for(var i = 1; i < 6; i++) { if(d[i] == 1) { ones++; } } return ones; } break; } } //html <tr> <td><label id="Label1">Ones</label></td> <td><input id="category" name="Category1" type="text" nmouseover = "getValue(1)" /></td> </tr>




Reply With Quote