select选择最近3年的年份查询
<select id="selectyear" ></select> /*****自动给select 赋值显示最近3年的年份*****/ window.onload = function(){ for(var i=0;i<3;i++){ $("#selectyear").append("<option value='' disabled selected hidden>请选择年份</option><option value='"+(new Date().getFullYear()-i)+"'>"+(new Date().getFullYear()-i)+"</option>"); } }