Дата: Вторник, 21.04.2009,
|
|
zanyda
Султан велыкого Зануды)
Группа: Администраторы
Сообщений: 225
|
Code <script language="JavaScript"> <!-- var concertMonth = new Array (1,1,1,2,3,4,5,6,7,8,11,11,12,12) var concertDay = new Array (1,13,14,23,8,1,1,12,26,2,2,17,12,19) concertNum = 14 concertNum = 14 // При добавлении праздничной даты надо добавить месяц в var concertMonth = new Array // и день в var concertDay = new Array // и название праздника в var concertInfo = new Array. var today = new Date var dayName = new Array ("Вс","Пн","Вт","Ср","Чт","Пт","Сб") var monthName = new Array ("ЯНВАРЬ", "ФЕВРАЛЬ", "МАРТ", "АПРЕЛЬ", "МАЙ", "ИЮНЬ", "ИЮЛЬ", "АВГУСТ", "СЕНТЯБРЬ", "ОКТЯБРЬ", "НОЯБРЬ", "ДЕКАБРЬ") document.write("<b>" + monthName[today.getMonth()] + "</b>") // find what day is the first day of this month day = today.getDay() result = (today.getDate() % 7)-1 if (result > day) { day += 7 } firstDay = day - result // find how many days this month has (note Jan=0, Dec=11) if (today.getMonth() == 1) { // 1/26/1999, added code to deal with leap years thisYear = today.getYear() + 1900 if (thisYear % 4 == 0) { if (thisYear % 100 == 0) { if (thisYear % 400 == 0) { daysInMonth = 29 } else { daysInMonth = 28 } } else { daysInMonth = 29 } } else { daysInMonth = 28 } } else { if (today.getMonth() == 0 || today.getMonth() == 2 || today.getMonth() == 4 || today.getMonth() == 6 || today.getMonth() == 7 || today.getMonth() == 9 || today.getMonth() == 11) { daysInMonth = 31 } else { daysInMonth = 30 } } // display the calender document.write("
<table border=0 cellspacing=2 cellpadding=3><tr>") // display the names of the days at the top for (i = 0; i < 7; i++) { document.write("<th width=20% bgcolor=f5f5f5 align=center><small>" + dayName[i] + "</small></th>") } document.write("</tr><tr>") // write any blank boxes ahead of the first day for (i = 0; i < firstDay; i++) { document.write("<td width=20% bgcolor=ffffff></td>") } // display the days d = firstDay for (i = 1; i <= daysInMonth; i++) { if (!(d < 7)) { document.write("<tr></tr>") d = 0 } if (i == today.getDate()) { dispDay = '<b>' + i + '</b>' } else { dispDay = i } for (var y = 0; y < concertNum; y++) { if (i == concertDay[y] && (concertMonth[y]-1) == today.getMonth()) dispDay = '<font color=ff0000>' + dispDay + '</font>' } document.write("<td width=20% bgcolor=ffffff align=center>" + dispDay + "</td>") d++ } if (d < 7) { for (i = d; i < 7; i++) { document.write("<td width=20% bgcolor=ffffff></td>") } } document.write("</tr></table>") //--> </script>
| |