fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <form> <select id="pets"> <option>Cat</option> <option>Dog</option> <option>Horse</option> </select> </form> <p>单击下面按钮禁用下拉列表的第二项。</p> <button onclick="disableElement()">禁用选项</button> <script> function disableElement(){ var sel=document.getElementById("pets") sel.options[1].disabled=true; } </script> </body> </html>
运行结果