isInArray()
May 17th, 2005 by Intermanaut
If you want to check whether a particular value is in an array, call this function with something like this.
if (isInArray(MyValue, MyArray))
<script type=”text/javascript”>
<!–
function isInArray(needle, arrayHaystack)
{
for (x=0; x < arrayHaystack.length; x++)
if (arrayHaystack[x] == needle)
return true;
return false;
}
–>
</script>