Form Select Box

[Total: 0    Average: 0/5]

This shows how to gain access to a form select box’s current value upon a user clicking an option.

Body Code:

<form name="ef1">
<input name="t1" type="text" value="<default>">
<select name="s1" size=4 onClick="updateIt()">
    <option value="first">one
    <option value="second">two
</select>
</form>
<script type=text/javascript>
function updateIt() {
  document.ef1.t1.value = document.ef1.s1.value;
}
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *