在输入文本框的值并单击添加按钮后,如何在选择框(下拉菜单)中选择我新添加的值?
<html>
<head>
<script>
function addref(value) {
var x = document.getElementById("thebox");
var option = document.createElement("option");
option.text = value
x.add(option,x.options[null])
}
</script>
</head>
<body>
<form>
<select id="thebox">
</select>
</form>
<br>
<input type="text" id="theinput"/>
<input type="button" value="Add" name="B1" onclick="addref(document.getElementById('theinput').value)"/>
</body>
</html>