Visualizzazione dei risultati da 1 a 3 su 3

Discussione: select e textfield

  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2003
    Messaggi
    51

    select e textfield

    buonasera....
    ho una select:
    vorrei che a seconda di quello che seleziono nella select mi appaia in un textfield il testo che ho selezionato, e la possibilità di aggiungere più elementi che ci sono nella select sempre nello stesso textfield...
    è possibile tutto ciò?????

    grazie
    :b

  2. #2
    codice:
    <select onchange="this.form.campo.value+=' '+this.options[this.selectedIndex].value;">
    ciao

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2003
    Messaggi
    51
    grazie Funziona.....!!!

    solo una cosa come posso fare per assegnare un valore alla select...
    premetto che i valori in questa select sono passati da questa funzione:

    <script type="text/javascript">
    // Create arrays containing state cities
    // Note: These arrays could be created dynamically
    var arrStates, arrFlorida, arrNewYork, arrTennessee
    arrFlorida = ["Daytona Beach", "Miami", "Orlando", "Tampa"]
    arrNewYork = ["Albany","New York", "Oakland", "Rochester"]
    arrTennessee = ["Gatlinburg", "Knoxville", "Memphis", "Nashville"]
    arrStates =[arrFlorida, arrNewYork, arrTennessee]
    // Function to handle dynamically altering the contents of the City List box
    function handleChange(newDisplay)
    {___var StateSelect, CitySelect, NumEntries, i
    ____StateSelect = document.frm.States
    ____CitySelect = document.frm.Cities
    __// Delete all entries in the cities list box
    __for (i = CitySelect.length; i > 0; i--)
    __{
    ____CitySelect.options[i-1] = null
    __}
    __// Add comment option to City List box
    __CitySelect.options[0] = new Option("-- Select City --",0)
    __// If state is selected add its cities to the City List box
    __if (newDisplay >= 0)
    __{
    ____NumEntries = arrStates[newDisplay].length
    ____for (i = 1; i <= NumEntries; i++)
    ____{
    ______CitySelect.options[i] = new Option((arrStates[newDisplay])[i-1],(i))
    ____}
    __}
    __CitySelect.selectedIndex = 0
    }
    </script>

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.