js让怎么让月份加1 js 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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"; 你这好像反了 楼主是value的值比 文本的大一个月 那就把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); .......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>");....... 那就把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); 那就把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); 那就把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 菜鸟级别女生请教大家:JSP中判断空值的方法 cookie 无法获取? jq 获取 对象 The server encountered an internal error () that prevented it from fulfilling th 求助一个弹出页面问题 在head中引用一个css,然后在javascript中修改table的style不起作用 关于播放背景音乐的问题 window.open全屏的问题 jquery实现 获取选中的div的值 新人求教,isNaN的判断问题 关于JQUERY JS关于获取兄弟节点的问题
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";
你这好像反了 楼主是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);
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>");
.......
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]) + 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);
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