当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM remove() 方法
The remove() method is used to remove an option from a drop-down list.
remove() 方法可用来将下拉列表中的某个选项删除
selectObject.remove(index) |
<html> <head> <script type="text/javascript"> function removeOption() { var x=document.getElementById("mySelect") x.remove(x.selectedIndex) } </script> </head> <body> <form> <select id="mySelect"> <option>Apple</option> <option>Pear</option> <option>Banana</option> <option>Orange</option> <option>Melon</option> </select> <input type="button" onclick="removeOption()" value="Remove option"> </form> </body> </html> |
Remove options from a dropdown list
从下拉列表中删除某个可选项目
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
吃惊 | 欠揍 | 支持 | 很棒 | 一般 | 搞笑 | 扯淡 | 不解 |