I can't figure out how to validate that no duplicate numbers have been entered, and when they enter a duplicate number it should alert them that they can't do that. Can someone please help me out?
<style type="text/css">
body {text-align:center; background-color:#151B8D; color:white}
p.intro {text-align:center; font-size:24pt}
h1 {font-size:30pt}
</style>
<script type="text/javascript">
function enterValue(f)
{
var n=parseInt(f.number.value)
if(n < 1 || n > 9)
{
alert("Number must be between 1-9")
}
else
{
f.elements[f.boxValue.value].value=f.number.value
}
}
</script>
</head>
<h1>Do you want to play with...</h1>
<p class="intro">My Suduko Box?</p>
<form name="matrixBox" id="matrixBox">
<input type="reset" name="reset" value="Reset" style="background-color:#3BB9FF; color:#15317E;
border-color:#151B8D; font-size:12pt"><br/><br/>
<table align="center">
<tr>
<td> <input type="text" name="r1c1" size="1"> </td>
<td> <input type="text" name="r1c2" size="1"> </td>
<td> <input type="text" name="r1c3" size="1"> </td>
</tr>
<tr>
<td> <input type="text" name="r2c1" size="1"> </td>
<td> <input type="text" name="r2c2" size="1"> </td>
<td> <input type="text" name="r2c3" size="1"> </td>
</tr>
<tr>
<td> <input type="text" name="r3c1" size="1"> </td>
<td> <input type="text" name="r3c2" size="1"> </td>
<td> <input type="text" name="r3c3" size="1"> </td>
</tr>
</table>
<br/>
Value: <input type="text" name="number" size="1">
<br/><br/>
Box Number: <input type="text" name="boxValue" size="1">
<br><br/>
<input type="button" name="enterVal" value="Enter Value" style="background-color:#3BB9FF; color:#15317E;
border-color:#151B8D; font-size:12pt" onclick="enterValue(document.matrixBox)">
<!-Why can't I put the reset button here? If I do it moves the value entered to the next box
instead of the box it was suppose to go inside the matrix->
</form>
</body>
</html>