Input prompt

by fwait

HTML

<input type=text list=browsers >
<datalist id=browsers >
   <option> Google
   <option> IE9
</datalist>
<script>
function combo(thelist, theinput) {
    theinput = document.getElementById(theinput);
    var idx = thelist.selectedIndex;
    var content = thelist.options[idx].innerHTML;
    theinput.value = content;
}
</script>
<input type="text" id="theinput" name="theinput" />
<select name="thelist" onChange="combo(this, 'theinput')">
  <option>one</option>
  <option>two</option>
  <option>three</option>
</select>