//当前时间
var tmonth = new Date();
var year = tmonth.getFullYear();
var month = tmonth.getMonth();
var dom = $('.month');
//中间变量 记录
var tttmonth = '';
var tyear = '';
window.onload = function(){
!dom.hasClass("amonth")&&dom.addClass("amonth");
//当前日期
var date1 = new Date(year,month);
//当前月份
var tomonth = new Date().getMonth();
//
var today = new Date().getDate();
var dayhtml = [];
var week = ["日","一","二","三","四","五","六"];
for (var t=1;t<=3;t++){
dayhtml.push('
');
var date = date1;
month = date.getMonth()+t-1;
console.log(month);
if (month>=11) {
tyear = year+1;
tttmonth = month-12 ;
// month = 0;
}else{
tyear =year;
tttmonth = month;
}
if(tttmonth==-1){
tttmonth=11;
tyear = year;
}
dayhtml.push('
'+(tttmonth+1)+'月'+''+tyear+'
')
// dayhtml.push();
// $.each(week,function(i,v){
// dayhtml.push('
'+week[i]+'
')
// });
var str = '';
$.each(week,function(i,v){
str += '
'+week[i]+'
';
});
dayhtml.push('
'+str+'
')
var nextdate = new Date(year,month)
var firstweek = nextdate.getDay();
// var firstweek = month.getDay();
// var first = month.getDay();
var allday = new Date(parseInt(year),(parseInt(month)+1),0).getDate();
var daystr = '
';
for(var i = 0;i
'
};
if (month==tomonth){
for(i=1;i<=allday;i++){
if(i==today){
daystr+='
今天
'
}
else if(i
'+i+' '
}else{
daystr+='