Ciao a tutti
ho fatto una funzioncina messa in un file esterno .js
solo che questa non mi funziona correttamente
andando a inserire il testo da controllare con dei caratteri tipo è o à
la funzione salta perchè non esegue la RegExp
mi sono accorto che il problema però non è nella funzione ma nel file come viene interpretato dal browser
questo è quello che ho scritto e che vedo in dreamweaver o blocco note
questo quello che vedo se paro il file nel browser
naturalmente se vado a scrivere una parola tipo "pippò" non riesce ad andare avanti
come posso risolvere il problema???
Ciao e grazie
ho fatto una funzioncina messa in un file esterno .js
solo che questa non mi funziona correttamente
andando a inserire il testo da controllare con dei caratteri tipo è o à
la funzione salta perchè non esegue la RegExp
mi sono accorto che il problema però non è nella funzione ma nel file come viene interpretato dal browser
questo è quello che ho scritto e che vedo in dreamweaver o blocco note
Codice:
function isName(item){
var strRicerca = new RegExp("[^a-zA-Z'èéòàìù ]","g");
var strRicerca2 = new RegExp("[<>=.;:?/^\]","g");
var strRicerca3;
strRicerca3= "\\";
if ((item.search(strRicerca) != -1)||(item.search(strRicerca2)!= -1)||(item.indexOf(strRicerca3,1)!= -1)) return false;
return true;
}
questo quello che vedo se paro il file nel browser
naturalmente se vado a scrivere una parola tipo "pippò" non riesce ad andare avanti
Codice:
function isName(item){
var strRicerca = new RegExp("[^a-zA-Z'èéòà ìù ]","g");
var strRicerca2 = new RegExp("[<>=.;:?/^\]","g");
var strRicerca3;
strRicerca3= "\\";
if ((item.search(strRicerca) != -1)||(item.search(strRicerca2)!= -1)||(item.indexOf(strRicerca3,1)!= -1)) return false;
return true;
}
come posso risolvere il problema???
Ciao e grazie
Ultima modifica di un moderatore: