Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Controllo su 3 checkbox

    Ciao a tutti,

    faccio un controllo del genere su 3 checkbox:

    codice:
    function check() {
    
      with(document.quest1) {
        var ck1 = document.quest1.Imp1Dom1;
        var ck2 = document.quest1.Imp2Dom1;
        var ck3 = document.quest1.Imp3Dom1;
       
        if (ck1.checked && ck2.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell'importanza della domanda 1');
    	  return false;	  
            }
            
        if (ck2.checked && ck3.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell'importanza della domanda 1');
    	  return false;	  
            }        
    
        if (ck1.checked && ck3.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell'importanza della domanda 1');
    	  return false;	  
            }
            
            
    	}
      }
    che richiamo all'onsubmit della form:

    codice:
    <form name="quest1" method="post" onsubmit="return check();" action="quest2.asp">
    ora faccio la verifica, vado a checkare 2 visti su 3... oppure tutti e 3 e non mi dovrebbe far accedere alla pagina successiva.
    Risultato... riesco sempre ad accedervi

    L'errore JS che mi da è:

    "Previsto ')'"

    ma sinceramente non vedo dove possa mancare la parentesi

    Qualcuno mi può aiutare?

    Grazie
    You see beauty I see pain, You see sky and I see acid rain

  2. #2

    Re: Controllo su 3 checkbox

    codice:
    function check() {
    
      with(document.quest1) {
        var ck1 = document.quest1.Imp1Dom1;
        var ck2 = document.quest1.Imp2Dom1;
        var ck3 = document.quest1.Imp3Dom1;
       
        if (ck1.checked && ck2.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell\'importanza della domanda 1');
    	  return false;	  
            }
            
        if (ck2.checked && ck3.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell\'importanza della domanda 1');
    	  return false;	  
            }        
    
        if (ck1.checked && ck3.checked) {
          alert('Errore: impossibile avere 2 caselle vistate nell\'importanza della domanda 1');
    	  return false;	  
            }
            
            
    	}
      }
    PER CASO ti serve un guestbook, completamente personalizzabile?e PER CASO lo vuoi anche gratis e senza pop-up o dialer?E allora prova il nuovo NewAge GuestBook..Niente per caso, tutto perfetto

  3. #3
    azz grazie mille

    You see beauty I see pain, You see sky and I see acid rain

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.