Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    List box to text box

    hello how do i get the data from a listbox to go in to a text box

    eg if i select a city eg london in a list then click a button the word london goes in to the text box
    list box is called city
    textbox is called town

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's one way:
    Code:
    var theForm = document.forms["formname"];
    theForm.town.value = theForm.city.options[theForm.city.options.selectedIndex].value;
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •