var theDate=new Array();
calendar.head.innerText = calendar.today[0]+"-"+calendar.today+"-"+calendar.today;
theDate[0]=calendar.today[0]; theDate=calendar.today; theDate=calendar.today;
}
else{
var reg=/^d{4}-d{1,2}-d{2}$/
if(!defaultDate.match(reg)){
alert("默认日期的格式不正确nn默认日期可接受格式为:'yyyy-mm-dd'");
return;
}
var theDate=defaultDate.split("-");
calendar.head.innerText = defaultDate;
}
calendar.currentDate[0]=theDate[0];
calendar.currentDate=theDate;
calendar.currentDate=theDate;
theFirstDay=calendar.getFirstDay(theDate[0],theDate);
theMonthLen=theFirstDay+calendar.getMonthLen(theDate[0],theDate);
//calendar.setEventKey(); (本文来源于图老师网站,更多请访问http://m.tulaoshi.com)
calendar.calendarPad.style.display="";
var theRows = Math.ceil((theMonthLen)/7);
//清除旧的日历;
while (calendar.body.rows.length 0) {
calendar.body.deleteRow(0)
}
//建立新的日历;
var n=0;day=0;
for(i=0;i<theRows;i++){
theRow=calendar.body.insertRow(i);
for(j=0;j<7;j++){
n++;
if(ntheFirstDay && n<=theMonthLen){
day=n-theFirstDay;
calendar.insertBodyCell(theRow,j,day);
}