Ciao a tutti raga,
ho un problema con un campo di testo sul quale applico un controllo.
Di fatto in IE funziona correttamente, cioè se il valore del campo non è del tipo richiesto viene visualizzato un alert ed il focus viene riportato sul campo contenente il valore errato.
In Netscape viene visualizzato l'alert ma il focus passa al campo successivo... sapreste darmi una spiegazione? Posto il codice per chiarezza.
Grazie a tutti.
codice:
var defaultEmptyOK = true;
//CONTROLLA SE UNA STRINGA E' VUOTA
//Valore restituito: TRUE se "s" è vuota.
function isEmpty(s) {return ((s == null) || (s.length == 0))}
//CONTROLLA SE UN CARATTERE E' UNA CIFRA
//Valore restituito: TRUE se "c" è una cifra.
function isDigit (c) {return ((c >= "0") && (c <= "9"))}
//CONTROLLA SE UNA STRINGA E' UN NUMERO INTERO SENZA SEGNO
//Valore restituito: TRUE se tutti i caratteri di "s" sono cifre.
function isInteger (s){
if (isEmpty(s))
if (isInteger.arguments.length == 1) return defaultEmptyOK;
else return (isInteger.arguments[1] == true);
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (!isDigit(c)) return false;
}
return true;
}
function qOK(object) {
if (!isInteger(object.value)) {
alert((lingua == "en" ? 'Quantity must be a number, please.' : 'Inserire un valore corretto per la quantità.'));
object.select();
return false;
}
}
__