Posted by Jonathan N. Little on 06/09/05 16:52
Hywel Jenkins wrote:
> In article <1118180230.644434.55400@g44g2000cwa.googlegroups.com>,
> goodminded@hotmail.com says...
>
>>Hi
>>
>>I have a field with a list of items. Like below:
>><select width="100" size="1" name="Industrielijst" style="font-family:
>>Arial; font-size: 8pt">
>><option value="P1">Plants</option>
>><option value="P2">Software</option>
>><option value="P3">Hardware</option>
>><option value="P4">System</option>
>><option value="P5">Screens</option>
>></select>
>>
>>Above this field I have a text field, like this.
>><input type="text" name="T1" size="40">
>>
>>Is it possible when I make a selection to place that selection in the
>>text field automatically? If so , how can I do that with javascript?
>>
>>Regards
>
>
> Untested:
> <select onchange="T1.value = this[this.selectedIndex].value;" ...
>
Couple things here..
1. Wrap the form elements in a form, else grabing T1 becomes very difficult
2. This DOES require Javascript to be ENABLED to work
3. The code:
<form>
<select width="100" size="1" name="Industrielijst" style="font-family:
Arial; font-size: 8pt"
onchange="this.form.T1.value=this.options[selectedIndex].value">
<option value="P1">Plants</option>
<option value="P2">Software</option>
<option value="P3">Hardware</option>
<option value="P4">System</option>
<option value="P5">Screens</option>
</select>
<input type="text" name="T1" size="40">
</form>
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
[Back to original message]
|