例子:向列表内添加数据
<select id="sel" style="width:200px;" size="10">
<option>11</option>
<option>22</option>
<option>33</option>
</select>
<input type="text" id="nr" />
<input type="button" value="添加" id="btn1" onclick="Add()" />
<script type="text/javascript">
function Add()
{
//取出用户输入的值
var v = document.getElementById("nr").value;
//向列表里面添加
var list = document.getElementById("sel");
list.innerHTML += "<option>"+v+"</option>";
alert(document.getElementById("sel").value);
}
</script>