<input name="MaremPersist" type="text" value="10" maxlength="3" onBlur="verificaMaremPersist(this.name,1,254);" />
codice:
function verificaMaremPersist(elem,min,max){
if(document.ASNform.elements[elem].value == ""){
alert("Inserisci un numero "+elem);
document.ASNform.elements[elem].focus();
return false;
}
else if(isNaN(document.ASNform.elements[elem].value)){
alert("Inserire solo numeri");
document.ASNform.elements[elem].focus();
return false;
}
else if((document.ASNform.elements[elem].value <= max) && (document.ASNform.elements[elem].value >= min)){
//alert("Valore OK");
}
else{
alert("Valore non correto");
}
}