function IsValid(value){
var valid = true;
if (isNaN(value) || value == ""){
valid = false;
}
return value;
}
Beginner at JavaScript so I'm sure this will be an easy question. We are using the above function to check the parameters and generate an error message. It works fine EXCEPT FOR the "isNaN" part of it.
if (IsValid(wind)) {
wind = parseFloat(wind);
if (wind < MIN_WIND || wind > MAX_WIND) {
SetError("divWindError", "Wind must be between " + MIN_WIND +
" and " + MAX_WIND);
return;
}
} else {
SetError("divWindError", "Wind is not valid");
return;
}
Aucun commentaire:
Enregistrer un commentaire