K Lo
11-14-2003, 04:21 AM
Hi can someone tell me what is wrong with the following codes:
function ValidateAgainstList(field1){
ListA=document.forms[0].tmp.value
ListAArray=ListA.split("\n");
var max=ListAArray.length;
var z;
for (z=0; z<max ; z++){
if (field1==ListAArray[z]) {
alert("duplicate");
return true;
break;
}
}
}
the value of field1 is Apple, while ListAArray returns Apple, Orange, Pear;
HOWever, the above code never comes in to the alert statement!
However, if field1 value is Pear, then i will get the alert statement.
Any one see anythings wrong?
function ValidateAgainstList(field1){
ListA=document.forms[0].tmp.value
ListAArray=ListA.split("\n");
var max=ListAArray.length;
var z;
for (z=0; z<max ; z++){
if (field1==ListAArray[z]) {
alert("duplicate");
return true;
break;
}
}
}
the value of field1 is Apple, while ListAArray returns Apple, Orange, Pear;
HOWever, the above code never comes in to the alert statement!
However, if field1 value is Pear, then i will get the alert statement.
Any one see anythings wrong?