循环添加option

来源:互联网 发布:sai for mac打不开 编辑:程序博客网 时间:2024/05/21 16:59

 <select id="selectUserNum" style="width: 60px; float: left;">

  <script type="text/javascript">
                            var selectID = document.getElementById("selectUserNum");
                            for (var i = 1; i <= 99; i++) {
                                selectID.options[i-1] = new Option(i, i);
                            }
                        </script>
                    </select>

 

原创粉丝点击