Visualizzazione dei risultati da 1 a 2 su 2

Discussione: modifica valori select

  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2002
    Messaggi
    141

    modifica valori select

    Ciao a tutti, ho questo problema in una pagina ho un form con due radio e una select box, in base al radio che scelgo voglio cambiare i valori della select, come faccio?
    Grazie

  2. #2
    codice:
      <html>
    
        <head>
          <script type="text/javascript" language="JavaScript">
          <!--
    
            function populateSelect( __hForm, __dwChoice )
            {
              if ( __dwChoice == 1 ) {
                with ( __hForm.elements["choice"] )
                {
                  options.length          = 0;
                  options[options.length] = new Option( "Testo #1", "Valore_1", false, false );
                  options[options.length] = new Option( "Testo #2", "Valore_2", false, false );
                  options[options.length] = new Option( "Testo #3", "Valore_3", false, false );
                }
              }
    
              else if ( __dwChoice == 2 ) {
                with ( __hForm.elements["choice"] )
                {
                  options.length          = 0;
                  options[options.length] = new Option( "Testo #4", "Valore_4", false, false );
                  options[options.length] = new Option( "Testo #5", "Valore_5", false, false );
                  options[options.length] = new Option( "Testo #6", "Valore_6", false, false );
                }
              }
            }
    
          //-->
          </script>
        </head>
    
        <body>
    
          <form>
            <input type="radio" name="defRadio" onclick="populateSelect( this.form, 1 );" /> Radio #1 #2 #3
    
            <input type="radio" name="defRadio" onclick="populateSelect( this.form, 2 );" /> Radio #4 #5 #6
    
    
            
    
    
    
            Selezioni disponibili: <select name="choice"></select>
          </form>
    
        </body>
    
      </html>
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

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.