1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do you write a combo box selection to a text box?

Discussion in 'JavaScript' started by Brandon Tanner, Jul 9, 2008.

  1. #1
    Hey everyone,

    What Javascript code would I use in the code below to write a combo box selection into a textbox? AND THEN, if I selected a 2nd selection from the combo box, it would write that in the same text box right after the 1st selection (in other words, it wouldn't erase the 1st selection).

    Of course, there would need to be a single space to separate each sentence that gets written to the text box.

    Thanks!

    =================================

    <html>

    <select name="ComboBox">
    <option value="">Option 1</option>
    <option value="">Option 2</option>
    <option value="">Option 3</option>
    </select>

    <textarea name="TextBox"></textarea>

    </html>

    =================================
     
    Brandon Tanner, Jul 9, 2008 IP
  2. seo8k

    seo8k Guest

    Messages:
    70
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <script>
    function CBtoTB()
    {
    document.getElementById("TextBox").value=document.getElementById("ComboBox").value
    }
    </script>
    <select id="ComboBox" onchange="CBtoTB()">
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
    </select>

    <textarea id="TextBox"></textarea>

    any more question you can PM me
     
    seo8k, Jul 13, 2008 IP