Javascript? So Selection from drop down box inserts corresponding text into a text bo

Discussion in 'JavaScript' started by clowes, Jun 2, 2006.

  1. #1
    I need a javascript I think, so that when someone selects something from a dropdown select box it inserts the corresponding text into the text box near by.

    For example in the drop down list there are a list of fruits. If you select apple it input £0.30 into the text box, if you select pear it inserts £0.45 etc

    Any help would be appreciated, I will give rep etc.
    Thanks
     
    clowes, Jun 2, 2006 IP
  2. clowes

    clowes Active Member

    Messages:
    345
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #2
    *bump* Please guys, I really need this. Will pay $
     
    clowes, Jun 3, 2006 IP
  3. x2i

    x2i Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Will this help. Lemme no if it doesnt.

    
    <SELECT ONCHANGE="document.all.selItem.value = this.value">
     <OPTION VALUE="£0.50"> Apples </OPTION>
     <OPTION VALUE="£0.45"> Pears </OPTION>
     <OPTION VALUE="£0.60"> Bananas </OPTION>
    </SELECT>
    
    <INPUT TYPE="text" ID="selItem">
    
    Code (markup):
     
    x2i, Jun 8, 2006 IP