1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5 86 87 88 89 90 |
var calutil = {getdaysinmonth:function (imonth, iyear) {var dprevdate = new Date (iyear, imonth, 0); return dprevdate.ge Tdate (); }, Bulidcal:function (Iyear, imonth) {var amonth = new Array (); amonth[0] = new Array (7); amonth[1] = new Array (7); AMon TH[2] = new Array (7); AMONTH[3] = new Array (7); AMONTH[4] = new Array (7); AMONTH[5] = new Array (7); AMONTH[6] = new Array (7); var dcaldate = new Date (Iyear, iMonth-1, 1); var idayoffirst = Dcaldate.getday (); var idaysinmonth = Calutil.getdaysinmonth (Imonth, iyear); var ivardate = 1; var d, W; Amonth[0][0] = "Day"; AMONTH[0][1] = "one"; AMONTH[0][2] = "two"; AMONTH[0][3] = "three"; AMONTH[0][4] = "four"; AMONTH[0][5] = "five"; AMONTH[0][6] = "six"; for (d = Idayoffirst D < 7; d++) {amonth[1][d] = ivardate; ivardate++;} for (w = 2; w < 7; w++) {for (d = 0; D & Lt 7; d++) {if (ivardate <= idaysinmonth) {amonth[w][d] = ivardate; ivardate++;}}} return amonth; }, Ifhassigned:function (Signlist,day) {var signed = false; $.each (signlist,functIon (Index,item) {if (Item.signday = = day) {signed = true; return false;}}); return signed; }, Drawcal:function (Iyear, Imonth, signlist) {var mymonth = calutil.bulidcal (iyear, imonth); var htmls = new Array (); h Tmls.push ("<div class= ' sign_main ' id= ' Sign_layer ' >"); Htmls.push ("<div class= ' Sign_succ_calendar_title ' >"); Htmls.push ("<div class= ' calendar_month_next ' > </div>"); Htmls.push ("<div class= ' Calendar_month_prev ' > </div>"); Htmls.push ("<div class= ' Calendar_month_span ' >2015 year April </div>"); Htmls.push ("</div>"); Htmls.push ("<div class= ' sign ' id= ' sign_cal ' >"); Htmls.push ("<table>"); Htmls.push ("<tr>"); Htmls.push ("<th>" + mymonth[0][0] + "</th>"); Htmls.push ("<th>" + mymonth[0][1] + "</th>"); Htmls.push ("<th>" + mymonth[0][2] + "</th>"); Htmls.push ("<th>" + mymonth[0][3] + "</th>"); Htmls.push ("<th>" + mymonth[0][4] + "</th>"); Htmls.push ("<TH≫ "+ mymonth[0][5] +" </th> "); Htmls.push ("<th>" + mymonth[0][6] + "</th>"); Htmls.push ("</tr>"); var d, W; for (w = 1; w < 7; w++) {Htmls.push ("<tr>"), for (d = 0; d < 7; d++) {var ifhassigned = calutil.ifhassigned ( SIGNLIST,MYMONTH[W][D]); Console.log (ifhassigned); if (ifhassigned) {Htmls.push ("<td class= ' on ' >" + (!isnan (mymonth[w][d))? Mymonth[w][d]: "") + "</td>"); else {Htmls.push ("<td>" + (!isnan (Mymonth[w][d]) mymonth[w][d]: "") + "</td>");} Htmls.push ("</tr>"); } htmls.push ("</table>"); Htmls.push ("</div>"); Htmls.push ("</div>"); Return Htmls.join ("); } }; |