I'm not that well versed in JavaScript, and there may be a more elegant solution, but try this:
[php]<script language="javascript">
<!--
function validate() {
var input_value = document.theform.theinput.value;
var good_values_list = new Array(123, 132, 213, 231, 312, 321);
var found = false;
var i;
for (i = 0; i < good_values_list.length; i++) {
if (good_values_list[i] == input_value) {
found = true;
break;
}
}
alert("In list: " + found);
return found;
}
-->
</script>[/php]
[php]<form action="WHATEVER.cgi" onsubmit="return validate();" name="theform">
<input type="text" name="theinput">
<input type="submit">
</form>[/php]
Replace your values in the array. When the onsubmit handler in the form returns false, the form action is canceled. If you want just the alert box whether the input is good or not, use onsubmit="validate();return false;"