|
|
Строка 25: |
Строка 25: |
| <br> | | <br> |
| <b>Друзья:</b> [[Участник: Лаптева Елена|Ленуська Лаптева]],[[Участник: Кузнецова Наталья|Кузнецова Наталья]] | | <b>Друзья:</b> [[Участник: Лаптева Елена|Ленуська Лаптева]],[[Участник: Кузнецова Наталья|Кузнецова Наталья]] |
− |
| |
− | <script language="JavaScript" type="text/javascript">
| |
− | var dDate = new Date();
| |
− | var cur_month = dDate.getMonth();
| |
− | var day_of_month = dDate.getDate();
| |
− | var cur_year = dDate.getFullYear();
| |
− | var Prev_Element = new Object();
| |
− | var bgcolor, webgcolor, wecolor, nwecolor, tbgcolor, ntbgcolor, sbgcolor
| |
− |
| |
− | function fToggle_color(the_Element) {
| |
− | var toggle_color = "#ff0000";
| |
− | if (the_Element.id == "cal_text") {
| |
− | if (the_Element.color == toggle_color) { the_Element.color = ""; }
| |
− | else { the_Element.color = toggle_color; }
| |
− | }
| |
− | else if ((the_Element.id == "cal_cell") || (the_Element.id == "today_cell")) {
| |
− | for (var i in the_Element.children) {
| |
− | if (the_Element.children[i].id == "cal_text") {
| |
− | if (the_Element.children[i].color == toggle_color)
| |
− | { the_Element.children[i].color = ""; }
| |
− | else { the_Element.children[i].color = toggle_color; }
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | function selected_day(the_Element) {
| |
− | if (the_Element.id == "cal_cell") {
| |
− | if (!isNaN(parseInt(the_Element.children["cal_text"].innerText))) {
| |
− | the_Element.bgColor = sbgcolor;
| |
− | Prev_Element.bgColor = ntbgcolor;
| |
− | document.all.selected_date.value =
| |
− | parseInt(the_Element.children["cal_text"].innerText);
| |
− | Prev_Element = the_Element;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | function DaysInMonth(iMonth, iYear) {
| |
− | var prev_date = new Date(iYear, iMonth, 0);
| |
− | return prev_date.getDate();
| |
− | }
| |
− |
| |
− | function build_cal(iYear, iMonth) {
| |
− | var the_month = new Array();
| |
− | the_month[0] = new Array(7);
| |
− | the_month[1] = new Array(7);
| |
− | the_month[2] = new Array(7);
| |
− | the_month[3] = new Array(7);
| |
− | the_month[4] = new Array(7);
| |
− | the_month[5] = new Array(7);
| |
− | the_month[6] = new Array(7);
| |
− | var dCalDate = new Date(iYear, iMonth-1, 1);
| |
− | var day_first = dCalDate.getDay();
| |
− | var iDaysInMonth = DaysInMonth(iMonth, iYear);
| |
− | var iVarDate = 1;
| |
− | var i, d, w;
| |
− | if (day_first==0) { day_first=6 }
| |
− | else { day_first=day_first-1 }
| |
− |
| |
− | the_month[0][0] = "Пн";
| |
− | the_month[0][1] = "Вт";
| |
− | the_month[0][2] = "Ср";
| |
− | the_month[0][3] = "Чт";
| |
− | the_month[0][4] = "Пт";
| |
− | the_month[0][5] = "Сб";
| |
− | the_month[0][6] = "Вс";
| |
− |
| |
− | for (d = day_first; d < 7; d++) {
| |
− | the_month[1][d] = iVarDate
| |
− | iVarDate++;
| |
− | }
| |
− | for (w = 2; w < 7; w++) {
| |
− | for (d = 0; d < 7; d++) {
| |
− | if (iVarDate <= iDaysInMonth) {
| |
− | the_month[w][d] = iVarDate
| |
− | iVarDate++;
| |
− | }
| |
− | }
| |
− | }
| |
− | return the_month;
| |
− | }
| |
− |
| |
− | function draw_cal(iYear, iMonth, cell_width, cell_height, text_size,
| |
− | text_weight, ibgcolor, iwebgcolor, inwecolor, iwecolor,
| |
− | itbgcolor, intbgcolor, isbgcolor) {
| |
− | bgcolor = ibgcolor;
| |
− | webgcolor = iwebgcolor;
| |
− | wecolor = iwecolor;
| |
− | nwecolor = inwecolor;
| |
− | tbgcolor = itbgcolor;
| |
− | ntbgcolor = intbgcolor;
| |
− | sbgcolor = isbgcolor;
| |
− |
| |
− | var my_month;
| |
− | my_month = build_cal(iYear, iMonth);
| |
− | document.write("<table border='0'>")
| |
− | document.write("<tr align='center' style='BACKGROUND-COLOR:"+ bgcolor +
| |
− | ";FONT-SIZE:" + text_size + ";COLOR:"+ nwecolor +"'>");
| |
− | document.write("<td><b>" + my_month[0][0] + "</b></td>");
| |
− | document.write("<td><b>" + my_month[0][1] + "</b></td>");
| |
− | document.write("<td><b>" + my_month[0][2] + "</b></td>");
| |
− | document.write("<td><b>" + my_month[0][3] + "</b></td>");
| |
− | document.write("<td><b>" + my_month[0][4] + "</b></td>");
| |
− | document.write("<td style='BACKGROUND-COLOR:"+ webgcolor +";FONT-SIZE:" +
| |
− | text_size + ";COLOR:"+ wecolor +"'><b>" + my_month[0][5] +
| |
− | "</b></td>");
| |
− | document.write("<td style='BACKGROUND-COLOR:"+ webgcolor +";FONT-SIZE:" +
| |
− | text_size + ";COLOR:"+ wecolor +"'><b>" + my_month[0][6] +
| |
− | "</b></td>");
| |
− | document.write("</tr>");
| |
− | for (w = 1; w < 7; w++) {
| |
− | document.write("<tr align='center' valign='center'>")
| |
− | for (d = 0; d < 7; d++) {
| |
− | if (my_month[w][d]==day_of_month)
| |
− | { document.write("<td id=today_cell bgcolor='"+ tbgcolor +"'
| |
− | width='" + cell_width + "' height='" + cell_height + "'
| |
− | style='CURSOR:Hand;FONT-SIZE:" + text_size + ";FONT-WEIGHT:" +
| |
− | text_weight + "' onMouseOver='fToggle_color(this)'
| |
− | onMouseOut='fToggle_color(this)' onclick='selected_day(this)'>"); }
| |
− | else
| |
− | { document.write("<td id=cal_cell bgcolor='"+ ntbgcolor +"'
| |
− | width='" + cell_width + "' height='" + cell_height + "'
| |
− | style='CURSOR:Hand;FONT-SIZE:" + text_size + ";FONT-WEIGHT:" +
| |
− | text_weight + "' onMouseOver='fToggle_color(this)'
| |
− | onMouseOut='fToggle_color(this)' onclick='selected_day(this)'>"); }
| |
− |
| |
− | if (!isNaN(my_month[w][d]))
| |
− | { document.write("<font id=cal_text onclick=selected_day(this)>" +
| |
− | my_month[w][d]); }
| |
− | else
| |
− | { document.write("<font id=cal_text onclick=selected_day(this)>"); }
| |
− | document.write("</td>")
| |
− | }
| |
− | document.write("</tr>");
| |
− | }
| |
− | document.write("</table>")
| |
− | }
| |
− |
| |
− | function update(iYear, iMonth) {
| |
− | my_month = build_cal(iYear, iMonth);
| |
− | Prev_Element.bgColor = ntbgcolor;
| |
− | if (((iMonth-1)==cur_month) && (iYear==cur_year))
| |
− | { today_cell.bgColor = tbgcolor }
| |
− | else { today_cell.bgColor = ntbgcolor }
| |
− |
| |
− | document.all.selected_date.value = "";
| |
− | for (w = 1; w < 7; w++) {
| |
− | for (d = 0; d < 7; d++) {
| |
− | if (!isNaN(my_month[w][d]))
| |
− | { cal_text[((7*w)+d)-7].innerText = my_month[w][d]; }
| |
− | else { cal_text[((7*w)+d)-7].innerText = " "; }
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | var cur_date = new Date();
| |
− | fоrm_calendar.select_month.options[cur_date.getMonth()].selected = true;
| |
− | for (i = 0; i < fоrm_calendar.sel_year.length; i++)
| |
− | if (fоrm_calendar.sel_year.options[i].value == cur_date.getFullYear())
| |
− | fоrm_calendar.sel_year.options[i].selected = true;
| |
− | </script>
| |
− |
| |
− | <form name="fоrm_calendar" method="post" action="">
| |
− | <input type="hidden" name="selected_date" value="">
| |
− |
| |
− | <table border="0" bgcolor="white">
| |
− | <tr>
| |
− | <td align=center>
| |
− | <select name="select_month" onchange=
| |
− | 'update(fоrm_calendar.sel_year.value, fоrm_calendar.select_month.value)'>
| |
− | <option value="1">Январь</option>
| |
− | <option value="2">Февраль</option>
| |
− | <option value="3">Март</option>
| |
− | <option value="4">Апрель</option>
| |
− | <option value="5">Май</option>
| |
− | <option value="6">Июнь</option>
| |
− | <option value="7">Июль</option>
| |
− | <option value="8">Август</option>
| |
− | <option value="9">Сентябрь</option>
| |
− | <option value="10">Октябрь</option>
| |
− | <option value="11">Ноябрь</option>
| |
− | <option value="12">Декабрь</option>
| |
− | </select>
| |
− |
| |
− | <select name="sel_year" onchange=
| |
− | 'update(fоrm_calendar.sel_year.value, fоrm_calendar.select_month.value)'>
| |
− | <option value="2011">2011</option>
| |
− | <option value="2012">2012</option>
| |
− | <option value="2013">2013</option>
| |
− | <option value="2014">2014</option>
| |
− | <option value="2015">2015</option>
| |
− | </select>
| |
− | </td>
| |
− | </tr>
| |
− | <tr>
| |
− | <td>
| |
− | <script language="JavaScript" type="text/javascript">
| |
− | var cur_date = new Date();
| |
− | draw_cal(cur_date.getFullYear(), cur_date.getMonth()+1, 30, 16,
| |
− | "14px", "bold", "gray", "red", "white", "white", "red", "silver", "#F6F6F6");
| |
− | </script>
| |
− | </td>
| |
− | </tr>
| |
− | </table>
| |
− | </form>
| |