日历生成

日历的算法及结构生成

```

var qing=q;

var oDate=newDate();

var td=tds;

var dayNum=0;

for(vartep=0;tep<49;tep++){//初始化格子内部

td[tep].innerHTML=""

}

if(Month==1||Month==3||Month==5||Month==7||Month==8||Month==10||Month==12){

dayNum=31

}

if(Month==4||Month==6||Month==9||Month==11){

dayNum=30

}

if(Month==2&&this.isLeep(Month)){

dayNum=29

}

if(Month==2){

dayNum=28

}

oDate.setFullYear(year);

oDate.setMonth(Month-1);

oDate.setDate(1);

switch(oDate.getDay()){

case0:

for(vari=0;i

for(vari=0;i

td[i+6].innerHTML=i+1

}

}

break;

case1:

for(vari=0;i

td[i].innerHTML=i+1

}

break;

case2:

for(vari=0;i

td[i+1].innerHTML=i+1

}

break;

case3:

for(vari=0;i

td[i+2].innerHTML=i+1

}

break;

case4:

for(vari=0;i

td[i+3].innerHTML=i+1

}

break;

case5:

for(vari=0;i

td[i+4].innerHTML=i+1

}

break;

case6:

for(vari=0;i

td[i+5].innerHTML=i+1

}

//if(!this.hasClass(el,"nextTime")){

//    this.setAttr(td[qing+5],"class","red");

//}

break

};

```

你可能感兴趣的:(日历生成)