JavaScript 参考手册
Select multiple 属性
在下拉选项中选取多个选项
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function displayResult() { document.getElementById("mySelect").multiple = true; } </script> </head> <body> <form> <select id="mySelect" size="4"> <option>Apple</option> <option>Pear</option> <option>Banana</option> <option>Orange</option> </select> </form> <button type="button" onclick="displayResult()">允许多个选择</button> <p>按下Ctrl键来选择多个选项</p> </body> </html>
运行结果:
点击运行 »