1.增加option:
function addoption(pa0,pa1,pa2)//select控件,option显示的文本,option的value值
{
var option = document.createElement("option");
option.appendChild(document.createTextNode(pa1));
option.setAttribute("value",pa2);
pa0.appendChild(option);
}
2.获取选中option:
var obj = document.getElementByIdx_x(”testSelect”); //定位id
var index = obj.selectedIndex; // 选中索引
var text = obj.options[index].text; // 选中文本
var value = obj.options[index].value; // 选中值
3.删除选中option
var obj=document.getElementById('mySelect');
var index=obj.selectedIndex;
obj.options.remove(index);
4.清空select
mySelect.options.length=0;