Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the value of a selected list item

Status
Not open for further replies.

dalar

Programmer
Sep 19, 2004
18
0
0
GB
Hi guys,

here is a simple form...

<form id="myForm" name="myForm" method="post" action="">
<p>
<select name="Names" size="4" id="Names">
<option value="bob" selected="selected">bob</option>
<option value="andy">andy</option>
<option value="mike">mike</option>
<option value="paul">paul</option>
</select>
</p>
<p>
<input name="myText" type="text" id="myText" />
</p>
</form>

My question is really simple, but I have difficulty in using the list box with javascript, I would simply like it so that when a user clicks on any item in the selection list, the value appears in the textfield below....

its just a list of names, but I cant seem to work out how to get the value from the selection list since its multiple,

your help is appreciated, many thanks...
 
>[tt]<select name="Names" size="4" id="Names">[/tt]
[tt]<select name="Names" size="4" id="Names" [blue]onchange="this.form.myText.value=this.value"[/blue]>[/tt]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top