Ho questo codice nel file esterno
che richiamo nel form cosi:codice:function xxx1(){ var f = document.mioform1; var parole = new RegExp("(mel(a|e)|per(a|e))"); var stringhe = ["nome","suoemail","citta","messaggio"]; for (i=0; i<stringhe.length; i++){ var campo = eval(f+"." + stringhe[i]); if(campo.value.match(parole) && campo.value.match(parole)[0]){ campo.style.backgroundColor='red' campo.style.color='white' alert("La parola '"+campo.value.match(parole)[0]+"' non è ammessa"); campo.focus(); campo.style.color='' return false; } } return true; }
Quando lo testo da errore "object" non è definitocodice:<form...onsubmit="return xxx1() ">
su questa riga if(campo.value.match(parole) && campo.value.match(parole)[0]){
...ma non c'è quella parola (object)!!![]()
![]()
VVoVe:

VVoVe:
Rispondi quotando
