js如何删除option
1、动态创建select function createSelect(){var mySelect = document.createElement("select"); mySelect.id = "mySelect"; document.body.appendChild(mySelect); }

3、 //添加一个选项obj.add(new Option("文本","值")); //这个只能在IE中有效 obj.options.add(new Option("text","value")); //这个兼容IE与firefox }

5、删除一个选项optionfunction removeOne(){ var obj=document.getElementById('mySelect'); //index,要删除选项的序号,这里取当前选中选项的序号var index=obj.selectedIndex;obj.options.remove(index); }

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:56
阅读量:34
阅读量:26
阅读量:26
阅读量:25