codice:
for(c=0;c<array.length;c++){
if(document.getElementById("chiav").value==array[c]){
// CODICE
}}
Se non ho interpretato bene la tua domanda chiedo scusa.