Ciao a tutti!
Ho un problemino con una funzione..

Sto cercando di implementare un semplice controllo di campi di un form assieme alla funzione jcap che gestisce il captcha..

La funzione jcap è questa:
codice:
function jcap(){
		
		var uword = hex_md5(document.getElementById(jfldid).value);	
		
		if (uword!=cword[anum-1]) {
		alert("Enter the code as it is shown");
		document.getElementById(jfldid).focus();
		return false;
		}	
	
	return true;
	
	}
ovviamente funziona..
il problema si pone nel momento in cui voglio controllare l'inserimento di testo obbligatorio in un campo in questo modo:

codice:
function jcap(){
	with(document.friends) {			

		if(y_msg.value=="") {
		alert("Insert your message");
		y_msg.focus();
		return false;
		}
		
		var uword = hex_md5(document.getElementById(jfldid).value);	
		
		if (uword!=cword[anum-1]) {
		alert("Enter the code as it is shown");
		document.getElementById(jfldid).focus();
		return false;
		}	

	}	
	
	return true;
	
	}
ma così facendo continua a mostrarmi il messaggio "Enter the code as it is shown"
anche se inserito correttamente..

C'è da dire che inserendo anche solamente il controllo del captcha all'interno della condizione with(document.friends) non funziona!

codice:
function jcap(){
	with(document.friends) {
		
		var uword = hex_md5(document.getElementById(jfldid).value);	
		
		if (uword!=cword[anum-1]) {
		alert("Enter the code as it is shown");
		document.getElementById(jfldid).focus();
		return false;
		}	

	}	
	
	return true;
	
	}

dove sbaglio?

Spero possiate aiutarmi..
Grazie!
Claudio