View Full Version : List box to text box

03-22-2004, 11:31 PM
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

03-22-2004, 11:40 PM
Here's one way:

var theForm = document.forms["formname"];
theForm.town.value = theForm.city.options[theForm.city.options.selectedIndex].value;