// 公共设置 //var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); document.onclick = function() { if (event.srcElement.src != null && event.srcElement.src.indexOf("calendar.gif")) { return; } if (!document.all.calendar.contains(event.srcElement) && document.all.cl.style.visibility == "visible") { showHideLayers('cl','','hide'); } } var months = new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"); var daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31); //var days = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); var days = new Array("日","一","二","三","四","五","六"); var eventObj; //判断是否闰年 function getDays(month, year) { if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28; else return daysInMonth[month]; } //得到今天的年月日 function getToday() { this.now = new Date(); this.year = this.now.getFullYear(); this.month = this.now.getMonth(); this.day = this.now.getDate(); } today = new getToday(); //创建日历 function newCalendar() { today = new getToday(); var parseYear = parseInt(document.all.year[document.all.year.selectedIndex].text); var newCal = new Date(parseYear,document.all.month.selectedIndex,1); var day = -1; var startDay = newCal.getDay(); var daily = 0; if ((today.year == newCal.getFullYear()) && (today.month == newCal.getMonth())) day = today.day; var tableCal = document.all.calendar.tBodies.dayList; var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); for (var intWeek = 0; intWeek < tableCal.rows.length;intWeek++) { for (var intDay = 0;intDay < tableCal.rows[intWeek].cells.length;intDay++) { var cell = tableCal.rows[intWeek].cells[intDay]; if ((intDay == startDay) && (0 == daily)) daily = 1; if(day==daily) cell.className = "today"; else if(intDay == 6) cell.className = "sunday"; else if (intDay==0) cell.className ="satday"; else cell.className="normal"; if ((daily > 0) && (daily <= intDaysInMonth)) { cell.innerText = daily; daily++; } else cell.innerText = ""; } } } function findObj(n, d) { var p,i,x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) { d = parent.frames[n.substring(p+1)].document; n = n.substring(0,p); } if (!(x = d[n]) && d.all) x = d.all[n]; for (i=0; !x&&i pRight || vRight < pLeft) { continue; } else { vAnElement.style.visibility = pVisibility; } } } } } function showHideLayers() { var i,p,v,obj,args = showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) { if ((obj = findObj(args[i])) != null) { v = args[i+2]; if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; } obj.visibility=v; } } if (v == "hidden") { showSelectsInRect(document.all.cl.style.pixelLeft, document.all.cl.style.pixelTop, document.all.cl.style.pixelLeft + document.all.calendar.offsetWidth, document.all.cl.style.pixelTop + document.all.calendar.offsetHeight, "visible"); } else { showSelectsInRect(document.all.cl.style.pixelLeft, document.all.cl.style.pixelTop, document.all.cl.style.pixelLeft + document.all.calendar.offsetWidth, document.all.cl.style.pixelTop + document.all.calendar.offsetHeight, "hidden"); if (document.all.month.value == "") { document.all.month.selectedIndex = 0; } if (document.all.year.value == "") { document.all.year.selectedIndex = 0; } } } function hideElement(elmID){ for (i=0; i