jquery--递增--年份的选择

<select id="select_year"></select>
<script>
$(document).ready(function(){ 
    var head="<option value='' selected>全部</option>"; 
    var year=""; 
    var i=0; 
    for(i=2005;i<=2030;i++){ 
    year+="<option value='"+i+"'>"+i+"</option>"; 
    } 
    var total = head+year;
    $('#select_year').append(total);
});
</script>

 

posted @ 2016-04-06 08:53  fleam  阅读(269)  评论(0编辑  收藏  举报