Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Grinder
    Registrato dal
    Mar 2003
    Messaggi
    1,374

    Controlo valori già inseriti

    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.
    Dove sbaglio?
    "Se la montagna vien da te,
    e tu non sei Maometto,
    allora scappa, potrebbe essere una frana!"

  2. #2
    Utente di HTML.it L'avatar di Grinder
    Registrato dal
    Mar 2003
    Messaggi
    1,374
    "Se la montagna vien da te,
    e tu non sei Maometto,
    allora scappa, potrebbe essere una frana!"

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.