源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> <script> function disable(){ document.getElementById("mySelect").disabled=true; } function enable(){ document.getElementById("mySelect").disabled=false; } </script> </head> <body> <form> <select id="mySelect"> <option>苹果</option> <option>梨子</option> <option>香蕉</option> <option>橙子</option> </select> <br><br> <input type="button" onclick="disable()" value="禁用列表"> <input type="button" onclick="enable()" value="启用列表"> </form> </body> </html>
运行结果