您的位置:首页 > Web前端 > JavaScript

js操作select 兼容ie、chrome、Firefox

2010-07-04 13:46 681 查看
动态删除select中的所有options:
function deleteAllOptions(sel){
sel.options.length=0;
}

动态删除select中的某一项option:
function deleteOption(sel,indx){
sel.options.remove(indx);
}

动态添加select中的项option:
function addOption(sel,text,value){
sel.options.add(new Option(text,value));
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: