Debt Consolidation - Wordpress Themes - Self Improvement Articles Directory - Download Anime - Bet365 bonus

PDA

View Full Version : Get value from a <select>


Zynex
Feb 19th 2007, 3:28 am
I was wondering. Is it possible to retrieve the value of a select. I have a select with all the months of the year.

<select name="selection">
<option>januari</option>
<option>Februari</option>
<option>Maart</option>
<option>April</option>
<option>Mei</option>
<option>Juni</option>
<option>Juli</option>
<option>Augustus</option>
<option>September</option>
<option>Oktober</option>
<option>Novermber</option>
<option>December</option>
</select>

When someone chooses for instance "februari" I want that value to be given to an <input type="text" name="invoer">

I tried things like

invoer.value = selection.value;

But that did not work. How do I get this value??

Thanx in advance,

Zynex

nico_swd
Feb 19th 2007, 4:09 am
Try

document.getElementByName('invoer').setAttribute('value', document.getElementByName('selection').getAttribute('value'));