Forum Moderators: open
I have a <select multiple> with a few <option>s in it. I want it so when I double click one of the <option>s, it appends the value of that <option> to the <input type="text"> that last had focus.
It's so that I can have a list of commonly used keywords and easily throw a few of them into a keywords input.
<html><head><title>TEST</title>
<script type="text/javascript">
function getChoices(form)
{
var values, options, option, k=0;
values = new Array();
options = form.choices.options;
while(option=options[k++])
if(option.selected)
values[values.length] = option.value;
form.output.value = values.join(' ');
}
</script>
</head>
<body><form>
<select name="choices" multiple>
<option value="1">one
<option value="2">two
<option value="3">three
<option value="4">four
<option value="5">five
</select>
<input type="button" value="select" onclick="getChoices(this.form)">
<input name="output" type="textbox">
</form></body>
</html>