Controllo valori già inseriti

  • Creatore Discussione Creatore Discussione Grinder
  • Data di inizio Data di inizio

Grinder

Nuovo Utente
19 Mag 2005
9
0
0
Ho creato una funzione per controllare se in un gruppo di menu select vengono ripetute selezioni con lo stesso valore, però succede sempre che l'ultima select non risponde mai!
Codice:
for(i=0;i<totComponenti;i++){
	if((document.getElementById("compvar_"+Math.round(nVar-1)).value == document.getElementById("compvar_"+i).value)&&(document.getElementById("compvar_"+Math.round(nVar-1)).value != '#')&&((Math.round(nVar-1) != i)&&(Math.round(nVar-1)<totComponenti))){
		altriVal = true;
		document.getElementById("compvar_"+Math.round(nVar-1)).value = '#';
		document.getElementById("nComp_"+Math.round(nVar-1)).disabled = true;
		document.getElementById("compDesc_"+Math.round(nVar-1)).disabled = true;
		document.getElementById("compDesc_"+Math.round(nVar-1)).value = '';
		break
	}else{
		altriVal = false;
	}
	alert(Math.round(nVar-1) + " - " + i);
}
"nVar" corrisponde al numero identificativo di quel menu select, -1 perchè di base indico sempre il successivo.
 

Discussioni simili