日期:2014-05-16 浏览次数:20430 次
function Calendar(beginYear, endYear, language, patternDelimiter, date2StringPattern, string2DatePattern) { this.beginYear = beginYear || 1980; this.endYear = endYear || 2020; this.language = language || 0; this.patternDelimiter = patternDelimiter || "-"; this.date2StringPattern = date2StringPattern || Calendar.language["date2StringPattern"][this.language].replace(/\-/g, this.patternDelimiter); this.string2DatePattern = string2DatePattern || Calendar.language["string2DatePattern"][this.language]; this.dateControl = null; this.panel = this.getElementById("__calendarPanel"); this.iframe = window.frames["__calendarIframe"]; this.form = null; this.date = new Date(); this.year = this.date.getFullYear(); this.month = this.date.getMonth(); this.colors = {"bg_cur_day":"#00CC33","bg_over":"#EFEFEF","bg_out":"#FFCC00"} }; Calendar.language = { "year" : ["\u5e74", "", "", "\u5e74"], "months" : [ ["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"], ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"], ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"], ["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"] ], "weeks" : [["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"], ["Sun","Mon","Tur","Wed","Thu","Fri","Sat"], ["Sun","Mon","Tur","Wed","Thu","Fri","Sat"], ["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"] ], "clear" : ["\u6e05\u7a7a", "Clear", "Clear", "\u6e05\u7a7a"], "today" : ["\u4eca\u5929", "Today", "Today", "\u4eca\u5929"], "close" : ["\u5173\u95ed", "Close", "Close", "\u95dc\u9589"], "date2StringPattern" : ["yyyy-MM-dd", "yyyy-MM-dd", "yyyy-MM-dd", "yyyy-MM-dd"], "string2DatePattern" : ["ymd","ymd", "ymd", "ymd"] }; Calendar.prototype.draw = function() { calendar = this; var _cs = []; _cs[_cs.length] = '<form id="__calendarForm" name="__calendarForm" method="post">'; _cs[_cs.length] = '<table id="__calendarTable" width="100%" border="0" cellpadding="3" cellspacing="1" align="center">'; _cs[_cs.length] = ' <tr>'; _cs[_cs.length] = ' <th><input class="l" name="goPrevMonthButton" type="button" id="goPrevMonthButton" value="<" \/><\/th>'; _cs[_cs.length] = ' <th colspan="5"><select class="year" name="yearSelect" id="yearSelect"><\/select><select class="month" name="monthSelect" id="monthSelect"><\/select><\/th>'; _cs[_cs.length] = ' <th><input class="r" name="goNextMonthButton" type="button" id="goNextMonthButton" value=">" \/><\/th>'; _cs[_cs.length] = ' <\/tr>'; _cs[_cs.length] = ' <tr>'; for(var i = 0; i < 7; i++) { _cs[_cs.length] = '<th class="theader">'; _cs[_cs.length] = Calendar.language["weeks"][this.language][i]; _cs[_cs.length] = '<\/th>'; } _cs[_cs.length] = '<\/tr>'; for(var i = 0; i < 6; i++){ _cs[_cs.length] = '<tr align="center">'; for(var j = 0; j < 7; j++) { switch (j) { case 0: _cs[_cs.length] = '<td class="sun"> <\/td>'; break; case 6: _cs[_cs.length] = '<td class="sat"> <\/td>'; break; default:_cs[_cs.length] = '<td class="normal"> <\/td>'; break; } } _cs[_cs.length] = '<\/tr>'; } _cs[_cs.length] = ' <tr>'; _cs[_cs.length] = ' <th colspan="2"><input type="button" class="b" name="clearButton" id="clearButton" \/><\/th>'; _cs[_cs.length] = ' <th colspan="3"><input type="button" class="b" name="sele