por medio de DOM:
Código HTML:
<html>
<head>
<script>
function agregar() {
var val = document.getElementById("valor").value;
var opt =document.createElement("option");
var text = document.createTextNode(val);
opt.appendChild(text);
document.getElementById("target").appendChild(opt);
}
</script>
</head>
<body>
<select id="target"></select>
<input type="text" id="valor"><input type="button" value="agregar" onClick="agregar()">
</body>
</body>
</html>
por medio de innerHTML:
Código HTML:
<html>
<head>
<script>
function agregar() {
var val = document.getElementById("valor").value;
var opt = document.getElementById("target").innerHTML+"<option>"+val+"</option>";
document.getElementById("target").innerHTML = opt;
}
</script>
</head>
<body>
<select id="target"></select>
<input type="text" id="valor"><input type="button" value="agregar" onClick="agregar()">
</body>
</body>
</html>