1: aps 日历控件
index.html
Calendar.js window.iif=function(fstr){return typeof(fstr)=="string"?document.getElementById(fst r):fstr} var StarDate=1900; var EndDate=2099; var EnabledDate=new Date(1900,0,1); var CurrentDate=new Date(); var CurrentYear=CurrentDate.getYear(); var CurrentMonth=CurrentDate.getMonth()+1; var CurrentDay=CurrentDate.getDate(); var OutObj; function getdate(obj){ var curDate = new Date(); OutObj=obj; var x=iif(obj)["offsetLeft"]; var y=iif(obj)["offsetTop"]; Layer1.style.pixelLeft=x; Layer1.style.pixelTop=y+iif(obj)["offsetHeight"]; Layer1.style.display=Layer1.style.display=='none'?'block':'none'; } function outMonth(){ for(var m=0;m<12;m++){ iif("AllMonth").cells[m].innerHTML=(m+1).toString()+'月'; iif("AllMonth").cells[m].style.border=''; iif("AllMonth").cells[m].style.cursor='hand'; if(m==(CurrentMonth-1)){ iif("AllMonth").cells[m].style.border='1px solid #FFA64D'; }
} } function showday(val){ var tempcell,tempdate; var currMonth=Math.floor(val.replace('月','')); CurrentMonth=currMonth; CurrentDate=new Date(CurrentYear,CurrentMonth-1,CurrentDay); StatDay=new Date(CurrentYear,CurrentMonth-1,1); EndDay=new Date(CurrentYear,CurrentMonth-1,MaxDay(StatDay)); tempcell=6+StatDay.getDay()+1; for(var tempi=7;tempi<=48;tempi++){ iif("AllDay").cells[tempi].innerHTML=''; } for(var day=1;day<=EndDay.getDate();day++){ tempdate=new Date(CurrentYear,CurrentMonth-1,day); if(EnabledDate
'+day.toString()+''; } else iif("AllDay").cells[tempcell].innerHTML=day; if(day==CurrentDay){ setDayStyle(iif("AllDay").cells[tempcell]); } tempcell++; } if(CurrentDay>EndDay.getDate()) setDayStyle(iif("AllDay").cells[tempcell-1]); } function dayclick(obj,txt){ if(typeof(obj)=='object') setDayStyle(obj); CurrentDay=txt; OutObj.value=CurrentYear.toString()+'-'+CurrentMonth.toString()+'-'+CurrentDay.to String(); divclose(); } function setDayStyle(obj){ for(var tempi=7;tempi<=48;tempi++){ iif("AllDay").cells[tempi].style.fontstyle=''; iif("AllDay").cells[tempi].style.background=''; iif("AllDay").cells[tempi].style.fontweight=''; iif("AllDay").cells[tempi].style.border='';
} iif(obj).style.background='#F0F0F0'; iif(obj).style.fontstyle='italic'; iif(obj).style.fontweight='bold'; iif(obj).style.border='1px solid #FFA64D'; } function MaxDay(fDate){ var newdate=new Date(fDate.getYear(),fDate.getMonth()+1,0) return newdate.getDate(); } function NextYear(obj,fYear){ var currYear=Math.floor(fYear.replace('年','')); if(currYear } else{ CurrentYear=EndDate; alert('已经到达系统支持的最大年份'); } showday(CurrentMonth.toString()); } function PrevYear(obj,fYear){ var currYear=Math.floor(fYear.replace('年','')); if(currYear>StarDate){ iif(obj).innerHTML=(currYear-1).toString()+'年'; CurrentYear=currYear-1; } else{ CurrentYear=StarDate; alert('已经到达系统支持的最小年份'); } showday(CurrentMonth.toString()); } function today(){ CurrentDate=new Date(); CurrentYear=CurrentDate.getYear(); CurrentMonth=CurrentDate.getMonth()+1; CurrentDay=CurrentDate.getDate(); showday(CurrentMonth.toString()); dayclick('',CurrentDay); } function divclose(){ Layer1.style.display='none';
} function CalenderInit(){ var content; content=''; content+='
'; content+=' | '; content+='xml:namespace prefix = td width="120" align="center" id="CurY" style="font-weight />'+CurrentYear.toString()+'年 | '; content+=' | '; content+='
|
日'; content+=' | 一 | 二 | 三 | 四 | 五 | <td align'; content+='="center">六
| | | '; content+=' | | | |
'; content+=' | | | | |