解决方案 »

  1.   

    document.write("<select id='et'>");
    var year =2008;
    var month =1;
    for(var i=0;i<90;i++){
    if(month>12){
    year++;
    month=1;
    var str_temp=month.toString();
    month="0"+str_temp;
    }else if(month<10){
    var str_temp=month.toString();
    month="0"+str_temp; }  var datestr = year+"-"+month;
     var split = datestr.split('-');
     var value = (parseInt(split[1]) - 1) < 1 ? (parseInt(split[0]) - 1) + "-12" : (parseInt(split[1]) - 1) < 10 ? split[0] + "-0"+(parseInt(split[1]) - 1) : split[0] + "-"+(parseInt(split[1]) - 1);
     document.write("<option value="+value+">"+datestr+"</option>");
     month++;
    }
    document.write("</select>"); document.getElementById('et').options[73].selected="selected";
      

  2.   


    你这好像反了 楼主是value的值比 文本的大一个月 
      

  3.   

    那就把value改下
    var value = (parseInt(split[1]) + 1) > 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) + 1) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
      

  4.   

    .......
    var datestr = year+"-"+month;var valueMonth = (month===12)? '01':'0'+(parseInt(month)+1),
          valueStr = (month===12)? (year+1+'-'+valueMonth):(year+'-'+valueMonth);

        
    document.write("<option value="+valueStr+'-01'+">"+datestr+"</option>");
    .......
      

  5.   

    那就把value改下
    var value = (parseInt(split[1]) + 1) > 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) + 1) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
    为什么喜欢+-1呢   他这边不是用Date搞出来的月份 month不会比实际的小一呢
    var value = (parseInt(split[1]) )> 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) ) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
      

  6.   

    那就把value改下
    var value = (parseInt(split[1]) + 1) > 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) + 1) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
    为什么喜欢+-1呢   他这边不是用Date搞出来的月份 month不会比实际的小一呢
    var value = (parseInt(split[1]) )> 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) ) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
    错了 应该是var value = (parseInt(split[1]) )> 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1])+1 ) < 10 ? split[0] + "-0"+(parseInt(split[1])+1 ) : split[0] + "-"+(parseInt(split[1]) + 1);
      

  7.   

    那就把value改下
    var value = (parseInt(split[1]) + 1) > 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) + 1) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
    为什么喜欢+-1呢   他这边不是用Date搞出来的月份 month不会比实际的小一呢
    var value = (parseInt(split[1]) )> 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1]) ) < 10 ? split[0] + "-0"+(parseInt(split[1]) + 1) : split[0] + "-"+(parseInt(split[1]) + 1);
    错了 应该是var value = (parseInt(split[1]) )> 12 ? (parseInt(split[0]) + 1) + "-01" : (parseInt(split[1])+1 ) < 10 ? split[0] + "-0"+(parseInt(split[1])+1 ) : split[0] + "-"+(parseInt(split[1]) + 1);鹅鹅鹅     脑子不清楚。。 。 你是对的= =  sorry