源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> <script> function changeSize(){ document.getElementById("mySelect").size=4; } </script> </head> <body> <form> <select id="mySelect"> <option>苹果</option> <option>香蕉</option> <option>橙子</option> <option>甜瓜</option> </select> <input type="button" onclick="changeSize()" value="修改列表大小"> </form> </body> </html>
运行结果